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 表明这是系统命
相关文章
相关标签/搜索