Peter Hansen wrote: > Kent Johnson wrote: > >> The simplest fix is to use raw strings for all your Windows path needs: >> os.path.isfile(r'c:\bookmarks.html') >> os.path.isfile(r'c:\wumpus.c') > > > Simpler still is almost always to use forward slashes instead: > > os.path.isfile('c:/bookmarks.html') > os.path.isfile('c:/wumpus.c') > > The only time this doesn't really work is when you pass the path to the > Windows "shell". Or when you naively compare paths without using > something like normpath() on them first...
I often copy paths from Windows Explorer and paste them into Python strings. (I hate typing paths!) Raw strings are much handier in that case - no editing required on the path. Kent -- http://mail.python.org/mailman/listinfo/python-list