On Sat, Dec 3, 2011 at 9:04 PM, Steven D'Aprano
<steve+comp.lang.pyt...@pearwood.info> wrote:
> If you can deal with the difference between these two lines without
> getting confused:
>
> print md5.md5("spam").hexdigest()  # Python 2.x
> print(hashlib.md5("spam").hexdigest())  # Python 3.x

The second line needs to be:
print(hashlib.md5("spam".encode()).hexdigest())

Relatively insignificant differences, since Python 2 and Python 3 both
support both bytes and unicode strings. The only difference is that
Py3 makes Unicode the default, forcing you to be explicit when you
want bytes.

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

Reply via email to