您的位置:首页 > 运维架构 > Linux

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

2019-07-29 10:42 1136 查看
原文链接:http://www.cnblogs.com/liujx2019/p/11262592.html

 

import subprocess

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

 

转载于:https://www.cnblogs.com/liujx2019/p/11262592.html

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: