Python执行Linux cmd命令,获取输出的一种方法,输出是bytes

 

import subprocess

p = subprocess.Popen('df -lh', stdout=subprocess.PIPE, shell=True)
print(p.stdout.read())

 

posted on 2019-07-29 10:42  liujx2019  阅读(836)  评论(0编辑  收藏  举报

导航