[Tutor] str format conversion help

ALAN GAULD alan.gauld at btinternet.com
Thu Jul 15 11:13:27 CEST 2010



> print "[%s]" % ('-'.join([hex(v) for v in  theValue]) )

Oops, that leaves 0x at the front of each byte.

You could strip that off with

print "[%s]" % ('-'.join([hex(v)[2:] for v in  theValue]) )

Sorry,

Alan G.


More information about the Tutor mailing list