40_Python 調用可執行文件.exe的方法
1. os.popen方法
import os,time
os.chdir(folder)
os.popen("aa.exe") # os.popen方法執行exe文件后繼續后續代碼
time.sleep(2.0)
print("aa.exe started successfully")
2. subprocess.getstatusoutput方法
import subprocess, time
os.chdir(folder)
subprocess.getstatusoutput("aa.exe") # subprocess.getstatusoutput方法執行exe文件后不會繼續執行后續代碼,須停止程序或異步執行程序放可執行后續代碼
time.sleep(2.0)
print("aa.exe started successfully")