看板 Python 關於我們 聯絡資訊
請問一下 python 要怎麼呼叫 C++或C#執行檔? 試著用 subprocess: cmd = 'program1.exe' retcode = subprocess.call(cmd, shell=True) 但是傳回 'program1.exe' is not recognized as an internal or external command, operable program or batch file. 請問要怎麼用相對位址去呼叫其他程式? -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 110.50.140.106 ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1516022555.A.BF4.html
uranusjr: 用絕對位置是最可靠的方法, 目前所在的檔案位置可以用 01/15 21:45
uranusjr: __file__ 變數拿到 01/15 21:45
uranusjr: 再搭配 os.path 或 pathlib 轉成絕對位置 01/15 21:46
TitanEric: 樓上正確 01/15 23:04
yoshien: Shell=False 01/15 23:32
jlindeberg: 好的 謝謝 01/16 22:03