import subprocess res=subprocess.Popen(‘dir‘,shell=True,stdout= subprocess.PIPE) #执行命令dir,将结果交给管道 res.stdout.read() #读取管道内容
python常用函数
原文:https://www.cnblogs.com/chrrydot/p/9839430.html