opening a file to read under windows

Darrell news at dorb.com
Sat Oct 9 22:19:58 EDT 1999


Give the name as "c:\\dir\\file.txt"
Because \d and \f are escape characters.
You can also use "c:/dir/file.txt"
Since /d and /f aren't escape characters.
Python will sort it out.

--
--Darrell

dave hatton <dave.hatton at mail.com> wrote in message
news:7tokcq$lab$1 at uranium.btinternet.com...
> Help!
>
> This is driving me mad!
>
> How should I open a text file for reading under windows? (98 in this case)
>
> Every thing I try results in an error message which shows the filename
> correctly but with "\\" between each element not "\"
>
> I'm using "fd = open(filename, 'r')" where filename="c:\dir\file.txt"
>
> Thanks
>
> Daveh
>
>
>
>
>
> --
> http://www.python.org/mailman/listinfo/python-list






More information about the Python-list mailing list