Tag Archives: commands.getstatusoutput

Python执行系统命令的方法 os.system(),os.popen(),commands.getstatusoutput()

最近在做那个测试框架的时候发现 Python 的另一个获得系统执行命令的返回值和输出的类。
最开始的时候用 Python 学会了 os.system() 这个方法是很多比如 C,Perl 相似的。

os.system(‘cat /proc/cpuinfo’)

但是这样是无法获得到输出和返回值的,[......]

继续阅读

Posted in python 基础 | Tagged , , | Leave a comment