美文网首页
【Python】os.system()和os.popen()函数

【Python】os.system()和os.popen()函数

作者: 失语失芯不失梦 | 来源:发表于2019-05-07 10:11 被阅读0次

python调用Shell脚本,有两种方法:os.system(cmd)或os.popen(cmd),前者返回值是脚本的退出状态码,后者的返回值是脚本执行过程中的输出内容

os.system(cmd)——>输出的是二进制数,可直接看运行结果

os.popen(cmd)——>输出的是文件,可对文件内容继续操作

参考:

https://blog.csdn.net/sxingming/article/details/52071514

https://www.cnblogs.com/hdk1993/p/8428720.html

相关文章

网友评论

      本文标题:【Python】os.system()和os.popen()函数

      本文链接:https://www.haomeiwen.com/subject/vuitmftx.html