Python没有打开我选择的文件

0 python

码:

os.startfile("C:\finished.py")
Run Code Online (Sandbox Code Playgroud)

返回:

FileNotFoundError: [WinError 2] The system cannot find the file specified: 'C:\**x0cinished**.py'
Run Code Online (Sandbox Code Playgroud)

期望:拿C:\ finished.py

什么可能导致python像这样改变我的输入?

Dee*_*ace 5

'\f'是一个特殊字符(参见转义序列表).在使用r硬编码路径时,您应习惯使用(原始字符串):

os.startfile(r"C:\finished.py")