Fredrik Lundh wrote:
> Usman Ajmal wrote:
>
>> Is there any function for reading a file while ignoring *\n* occuring
>> in the file?
>
> can you be a bit more precise? are we talking about text files or
> binary files? how do you want to treat any newlines that actually
> appear in the file?
>
> </F>
>
Hi Usan,
I've always just done...
for each in open('filename.txt', 'r'):
each = each.rstrip()
You could wrap this as a generator if you really want it to be a one
liner, personally it's never seemed worth it to me.
Regards,
Roger Heathcote
http://www.technicalbloke.com
http://movingtoubuntu.technicalbloke.co.uk
--
http://mail.python.org/mailman/listinfo/python-list