with open('test-xxx', 'w') as f:
� � f.write('aaa\nbbb\nccc')
with open('test-xxx', 'r') as f:
� � print(f.readlines(1))

On Python 3.3 I get:

['aaa\n']

...while on Python 2.7:

['aaa\n', 'bbb\n', 'ccc']


Is this a bug or I'm missing something?


--- Giampaolo
https://code.google.com/p/pyftpdlib/
https://code.google.com/p/psutil/
https://code.google.com/p/pysendfile/
_______________________________________________
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/songofacandy%40gmail.com


-- 
INADA Naoki� <songofacandy@gmail.com> ">

(original) (raw)

The builtin open() was replaced with io.open().
It's difference between file.readlines() and io.IOBase.readlines().


On Sat, Apr 6, 2013 at 2:15 AM, Giampaolo Rodol� <g.rodola@gmail.com> wrote:
with open('test-xxx', 'w') as f:
� � f.write('aaa\\nbbb\\nccc')
with open('test-xxx', 'r') as f:
� � print(f.readlines(1))

On Python 3.3 I get:

\['aaa\\n'\]

...while on Python 2.7:

\['aaa\\n', 'bbb\\n', 'ccc'\]


Is this a bug or I'm missing something?


\--- Giampaolo
https://code.google.com/p/pyftpdlib/
https://code.google.com/p/psutil/
https://code.google.com/p/pysendfile/
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
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/songofacandy%40gmail.com



--
INADA Naoki� <songofacandy@gmail.com>