我正在尝试调用应用程序并将文本文件作为参数传递。文本文件有说明。我尝试在打开记事本时传递一个参数,但无法让它工作。这是我正在尝试的代码:
import os
os.startfile(r"C:\Windows\notepad.exe c:\cobra\advancecalendar.txt")
If I don't include the path to the second file it launches notepad, but with the file name included i get the following error:
RESTART: C:/Users/timbo/AppData/Local/Programs/Python/Python36-32/Open exe module.py
Traceback (most recent call last):
File "C:/Users/timbo/AppData/Local/Programs/Python/Python36-32/Open exe module.py", line 3, in <module>
os.startfile(r"C:\Windows\notepad.exe c:\cobra\advancecalendar.txt")
FileNotFoundError: [WinError 2] The system cannot find the file specified: 'C:\\Windows\\notepad.exe c:\\cobra\\advancecalendar.txt'
如何将参数传递给 startfile 以便它打开特定文件?当我尝试将两者都放在引号中时,它仍然出现错误。