A silly question on file opening
joy99
subhakolkata1234 at gmail.com
Fri Feb 12 15:32:29 EST 2010
More information about the Python-list mailing list
Fri Feb 12 15:32:29 EST 2010
- Previous message (by thread): A silly question on file opening
- Next message (by thread): A silly question on file opening
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Feb 11, 1:57 am, Anthony Tolle <anthony.to... at gmail.com> wrote: > On Feb 10, 3:42 pm,joy99<subhakolkata1... at gmail.com> wrote: > > > Dear Group, > > [snip] > > I tried to change the location to D:\file and as I saw in Python Docs > > the file reading option is now "r+" so I changed the statement to > > file_open=open("D:\file","r+") > > but it is still giving error. > > Only use "r+" if you need to also write to the file. "r" is still > good for opening for reading. > > Without seeing a traceback, I can only assume the error is caused by > using a backslash in the path without escaping it. Try either the > following: > > file_open=open("D:\\file","r+") > > file_open=open(r"D:\file","r+") > > For an explanation, see the Python documentation: > > http://docs.python.org/reference/lexical_analysis.html#string-literals Dear Group, I am sorry I could not report. I was trying your solutions, I could try only one or two, they are working. My problem got solved. Thank you for your suggestions. But soon I find time, I would try all of them, so that I can learn more and what I try to do in this room to get better angles over any problem from experts like you. Thank you for giving me your valuable time despite your busy schedule. Wishing you happy day ahead, Best Regards, Subhabrata.
- Previous message (by thread): A silly question on file opening
- Next message (by thread): A silly question on file opening
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list