File Reading related query

Usman Ajmal uzmanajmal at gmail.com
Wed Sep 17 06:42:05 EDT 2008


I am talking about text file which contain multiple lines e.g following
three lines are there in my textfile.txt

this is python list
where we get support
from geeks

I want

sentence = this is python list where we get support from geeks

whereas when i use simple read() i get something like this

sentence = this is python list\nwhere we get support\nfrom geeks

On Wed, Sep 17, 2008 at 10:18 AM, Fredrik Lundh <fredrik at pythonware.com>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>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080917/676a7a13/attachment-0001.html>


More information about the Python-list mailing list