Os.startfile() Path In Python With Numbers
I am working on a little project in python for work. It involves opening a file with the os.startfile() And there in lies my problem : the path to the file contains several numbers
Solution 1:
The problem is that the \
character has a special meaning in python, e.g. \n
is a newline etc.
You can either do:
os.startfile(r"G:\EEGdatabase\6541455.docx")
Or:
os.startfile("G:\\EEGdatabase\\6541455.docx")
To solve the problem.
See https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals for details.
Post a Comment for "Os.startfile() Path In Python With Numbers"