os.popen()

os.popen()功能强于os.system(),os.popen()可以返回回显的内容,以文件描述符返回。eg:

1 #!/usr/bin/env python
2 # -*- coding: UTF-8 -*-
3 
4 import os
5 
6 test = os.popen("ping www.baidu.com")
7 print test.read()
原文地址:https://www.cnblogs.com/kratos0517/p/3063280.html