os.path.isfile
Steve D'Aprano
steve+python at pearwood.info
Sat Feb 11 22:52:09 EST 2017
More information about the Python-list mailing list
Sat Feb 11 22:52:09 EST 2017
- Previous message (by thread): os.path.isfile
- Next message (by thread): os.path.isfile
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sat, 11 Feb 2017 05:11 am, eproser at gmail.com wrote: > Hello NG > > Python 3.5.2 > > Windows 10 > > os.path.isfile() no recognise file with double dot? > > eg. match.cpython-35.pyc I doubt that very much. I expect you are probably writing something like this: path = 'My Documents\testing\path\match.cpython-35.pyc' os.path.isfile(path) and not realising that you have a TAB character in your string from the \t, or something similar. In Python, you should always use forward slashes for paths, even on Windows. path = 'My Documents/testing/path/match.cpython-35.pyc' Try printing the repr() of your path. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse.
- Previous message (by thread): os.path.isfile
- Next message (by thread): os.path.isfile
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list