No: readlines () retains the "\n"s; splitlines () loses them

Ah, thank you for the clarification!

On Fri, 04 Sep 2009 08:39:37 -0700, Tim Golden <m...@timgolden.me.uk> wrote:

Rami Chowdhury wrote:
f = open("myfile.txt", "r")
list_one = f.read().splitlines()
f.close()
 Or use f.readlines(), which would do the same thing IIRC?

No: readlines () retains the "\n"s; splitlines () loses them

TJG



--
Rami Chowdhury
"Never attribute to malice that which can be attributed to stupidity" -- Hanlon's Razor
408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to