John Machin <sjmachin <at> lexicon.net> writes: > On Mar 5, 12:13 pm, Benjamin Peterson <benja...@python.org> wrote: > > > > import binascii > > print binascii.hexlify(some_bytes) > > AFAICT binascii.hexlify(some_bytes) gives the SAME result as > some_bytes.encode("hex") for much more typing -- I see no > "better" > here.
So called encodings like "hex" and "rot13" are abuse of encode() method. encode() should translate between byte strings and unicode, not preform transformations like that. This has been removed in 3.x, so you should use binascii. -- http://mail.python.org/mailman/listinfo/python-list