En Mon, 04 Jun 2007 20:03:39 -0300, mike <[EMAIL PROTECTED]> escribió:
> I've researched python pretty much but still have no idea how to print > out each single character from a string in HEX format? Hope someone > can give me some hints. Thanks a lot. > > e.g. ###here is a string > > a='01234' > > ###how to print out it out in this way > > 0x31 0x31 0x32 0x33 0x34 py> a='01234' py> for c in a: ... print "%#x" % ord(c), ... 0x30 0x31 0x32 0x33 0x34 py> See <http://docs.python.org/lib/built-in-funcs.html#l2h-55> for the ord() function and <http://docs.python.org/lib/typesseq-strings.html> for the "%#x" format -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list