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
Post a Comment