John Salerno wrote:
> Paul Rubin wrote:
>
>> The preferred way to remove the newline is more like:
>> for line in open('C:\\switches.txt'):
>> print line.rstrip()
>
> Interesting. So I would say:
>
> [line.rstrip() for line in open('C:\\switches.txt')]
That seems to work. And on a related note, it seems to allow me to end
my file on the last line, instead of having to add a newline character
at the end of it so it will get sliced properly too.
--
http://mail.python.org/mailman/listinfo/python-list