> Great! It works.
>

There is a builtin function called hex() that does the same, but also shares 
the same problem as the solution above:

>>> hex(10)
'0xa'
>>>

This is probably not "nice" in your printouts, it doesn't allign.


with the printf inspired solution you can set the precision like this:

>>> a = "12\n34"
>>> for c in a:
...   print "%#04x" % ord(c),
...
0x31 0x32 0x0a 0x33 0x34
>>>


regards troels


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to