python: convert UUID to a string which is a C unsigned char[16] initializer -


(in case you're curious motivation: used in scons build generate c file containing guid)

i found question generating guid in python. don't know programming python. me convert string of form

"{0x**, 0x**, 0x**, 0x**, 0x**, 0x**, 0x**, 0x**, 0x**, 0x**, 0x**, 0x**, 0x**, 0x**, 0x**, 0x**}" 

where **'s filled in guid bytes in 2-digit hex form?

def getinitializer(someuuid):     hexbytelist = [??? b in someuuid.bytes]     return '{'+(', '.join(hexbytelist))+'}' 

i'm not sure use "???" above.

hex(ord(b)) 

...


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -