(in case you're curious about motivation: this will be used in a scons build to generate a C file containing a GUID)
I found the question about generating a GUID in python. But I don't really know much about programming python. Could someone help me convert this to a string of the form
"{0x**, 0x**, 0x**, 0x**, 0x**, 0x**, 0x**, 0x**, 0x**, 0x**, 0x**, 0x**, 0x**, 0x**, 0x**, 0x**}"
where the **'s are filled in with the GUID bytes in 2开发者_JS百科-digit hex form?
def getInitializer(someUUID):
hexByteList = [??? for b in someUUID.bytes]
return '{'+(', '.join(hexByteList))+'}'
I'm not sure what to use for the "???" above.
hex(ord(b))
...
精彩评论