标签:tput read port nbsp readline lin highlight class log
import os,subprocess
p = subprocess.Popen("df -h", shell=True, stdout=subprocess.PIPE)
out = p.stdout.readlines()
for line in out:
print line.strip()
将df -h的执行结果输出到stdout,再用readlines方法读出来,再print出来
import os,subprocess x = subprocess.check_output(["date", "+%T"]) print x
这个方法可以将某个命令的结果输出到python
标签:tput read port nbsp readline lin highlight class log
原文地址:http://www.cnblogs.com/rohero/p/6700709.html