No such file or directory: 'c:\\windows\\temp\\test'

Terry Reedy tjreedy at udel.edu
Sun Apr 15 18:59:20 EDT 2012


On 4/15/2012 5:13 AM, contro opinion wrote:

>  >>> f=open(r'c:\windows\temp\test','r')

>  >>> f=open('c:\\windows\\temp\\test','r')

Your life will be much happier is you use forward slashes for filenames 
in Python programs.
f = open('c:/windows/temp/test', 'r')

You only need backslashes when entering filenames in Command Prompt 
window that Command Prompt must interpret as a path.

-- 
Terry Jan Reedy




More information about the Python-list mailing list