On Feb 10, 3:42 pm, joy99 <[email protected]> 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
--
http://mail.python.org/mailman/listinfo/python-list