3
我有一個python腳本需要執行位於另一個目錄中的.jar
文件。什麼是最好的方法來做到這一點?到目前爲止,我在想 -如何執行需要在同一個目錄下的文件?
subprocess.call(["cd","/path/to/file"])
subprocess.call(["./file.jar"])
我應該怎麼做?
更新:
同時使用下面的答案,這是我落得這樣做:
subprocess.call(shlex.split("./file.jar -rest -of -command"), cwd=COMMAND_FOLDER)