Question about binary file reading

Benjamin Peterson benjamin at python.org
Thu Mar 5 02:13:08 CET 2009


Tino Wildenhain <tino <at> wildenhain.de> writes:
> Rhodri James wrote:
> > for b in x:
> >     print hex(ord(b))
> > 
> 
> better:
> 
> print x.encode("hex")

even better:

import binascii
print binascii.hexlify(some_bytes)







More information about the Python-list mailing list