Reading a file

aditya shukla adityashukla1983 at gmail.com
Thu Jul 24 22:06:08 CEST 2008


I have a text file whose contents are like this:-

jd|fj|dnv|jd|0.33|c:\\windows\\win32
shcbsbs|nscsjsj|0.93|hsbcjsnc

I am trying to read the file like this:-

>>> x = open("c:\\a.txt","r")
>>> x.read()

the result that i get is ike this:-
'jd|fj|dnv|jd|0.33|c:\\\\windows\\\\win32\nshcbsbs|nscsjsj|0.93|hsbcjsnc\n'

My doubt is how can i read the file as it is?

 ie my output should be

d|fj|dnv|jd|0.33|c:\\windows\\win32
shcbsbs|nscsjsj|0.93|hsbcjsnc


Thanks in advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080724/e7be8c41/attachment.html>


More information about the Python-list mailing list