python3 binascii.hexlify ...

Cameron Simpson cs at zip.com.au
Sat Feb 9 05:44:33 EST 2013


This seems to return a bytes object in Python 3.3.0. I was expecting a
string. The documentation here:

  http://docs.python.org/3/library/binascii.html#binascii.hexlify

also keeps me expecting a string. Am I missing something?

Example:

  [hg/css-venti-bytes+utf8]fleet*2> python3
  Python 3.3.0 (default, Nov 11 2012, 08:47:42) 
  [GCC 4.2.1 Compatible Apple Clang 4.0 ((tags/Apple/clang-421.0.60))]
  on darwin
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import binascii
  >>> binascii.hexlify(b'abc')
  b'616263'
  >>> 

I'm on a Mac but am hoping that is irrelevant.

Cheers,
-- 
Cameron Simpson <cs at zip.com.au>

You can fool too many of the people too much of the time. - James Thurber



More information about the Python-list mailing list