python 怎么执行dos命令

如题所述

写了几个批处理,主要是一些Android调试命令,现在想用python来搞,感觉更酷一些吧。O(∩_∩)O~

比如Ping命令:

ping www.baidu.com

用python来做,主要是使用了python标准库中的os库。

参见Python文档The Python Standard Library  =>  Generic Operating System Services  =>  os — Miscellaneous operating system interfaces.

这里介绍的比较全面,而且这个库我们用的也较多。

我们会用到os.system()方法:

[python] view plain copy

温馨提示:答案为网友推荐,仅供参考