File Handling Problem
Rami Chowdhury
rami.chowdhury at gmail.com
Fri Sep 4 12:52:34 EDT 2009
> 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 <mail at 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)
More information about the Python-list
mailing list