Grant Edwards wrote:
On 2005-01-18, Grant Edwards <[EMAIL PROTECTED]> wrote:

On 2005-01-18, tertius <[EMAIL PROTECTED]> wrote:


Is there a builtin function that will enable me to display the hex notation of a given binary string? (example below)

' '.join('%02x' % ord(b) for b in s)


Oops.  Should be:

' '.join(['%02x' % ord(b) for b in s])

The first works fine under Python 2.4, actually... you need the list comprehension only on previous versions.

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

Reply via email to