Getting hex value of a character
Lulu of the Lotus-Eaters
mertz at gnosis.cx
Thu Dec 12 13:45:54 EST 2002
P_spam_ at draigBrady.com wrote previously:
|''.join(map(lambda c: "%02X" % ord(c), "AB"))
You could save a few characters and avoid the dreaded lambda with:
"%02X"*len(s) % tuple(map(ord,s))
Yours, David...
--
mertz@ | The specter of free information is haunting the `Net! All the
gnosis | powers of IP- and crypto-tyranny have entered into an unholy
.cx | alliance...ideas have nothing to lose but their chains. Unite
| against "intellectual property" and anti-privacy regimes!
-------------------------------------------------------------------------
More information about the Python-list
mailing list