python調用Windows的cmd命令

import os import subprocess # 方案1 r1 = os.popen('dir') print(r1.read()) #方案2 r2 = subprocess.Popen('dir', shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) # cmd:命令 # shell = True 表明這是系統命
相關文章
相關標籤/搜索