Getting hex value of a character

Gerhard Häring gerhard.haering at opus-gmbh.net
Thu Dec 12 12:36:41 EST 2002


Dennis Reinhardt <DennisR at dair.com> wrote:
> I am trying to print the hexadecimal value of a string.  In other words, the
> string "AB" would print as "4142".  I simply cannot get the formatting
> right.

It's in the standard library:

>>> from binascii import hexlify
>>> hexlify("AB")
'4142'
-- 
Gerhard Häring
OPUS GmbH München
Tel.: +49 89 - 889 49 7 - 32
http://www.opus-gmbh.net/



More information about the Python-list mailing list