str(bytes) in Python 3.0

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Sat Apr 12 02:13:34 EDT 2008


Hello

Is this the intended behavior?

Python 3.0a4+ (py3k, Apr 12 2008, 02:53:16) [MSC v.1500 32 bit (Intel)] on  
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> x = b"abc"
>>> repr(x)
"b'abc'"
>>> str(x,"ascii")
'abc'
>>> str(x,"utf-8")
'abc'
>>> str(x)
"b'abc'"

On the last line, str(x), I would expect 'abc' - same as str(x, 'ascii')  
above. But I get the same as repr(x) - is this on purpose?

-- 
Gabriel Genellina




More information about the Python-list mailing list