python os.system os.popen 模块 调用命令行

1
2
3
4
5
6
7
8
9
import os 
from pprint import pprint
# 只能执行 不能获取返回信息
os.system('dir')


# 可以获取命令行返回信息
tmp = os.popen('dir ').readlines()
pprint(tmp)