python - os.path.isfile() returns false for existing Windows file -
for reason os.path.isfile() returns false existing windows files. @ first, assumed spaces in filename causing problem, other file paths spaces worked fine. here's copy python console illustrates issue:
>>> import os >>> os.path.isfile("c:\program files\internet explorer\images\bing.ico") false >>> os.path.isfile("c:\program files\internet explorer\images\pinnedsitelogo.contrast-black_scale-80.png") true
how can fix problem?
\b
in string means backspace. if want actual backslashes in string, need escaped more backslashes (\\
instead of \
), or need use raw string (r"..."
instead of "..."
). file paths, i'd recommend using forward slashes.
Comments
Post a Comment