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

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

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