On 6/28/2011 10:48 AM, Michael Foord wrote:
On 28/06/2011 15:36, Terry Reedy wrote:
S = open('myfile.txt').read()
now return a text string in both Py2 and Py3 and a subsequent
'abc' in S
works in both.
Nope, it returns a bytestring in Python 2.
Which, in Py2 is a str() object. In both Pythons, .read() in default
mode returns an object of type str() and 'abc' is an object of type
str() and so expressions involving undecorated string literals and input
just work, but would not work if input defaulted to bytes in Py 3. Sorry
if I was not clear enough.
--
Terry Jan Reedy
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com