有些注定了被遗忘的话,也就有的注定了属于沉静的自私.

Python库 subprocess/Popen

来自森亮号航海见识 {SLboat Insight;}
跳转至: 导航搜索

发现

  • 它看起来见识[1]可以彻底的打开一个shell进程

见识

Calling an external command in Python - Stack Overflow 沿途见识[1]

I typically use:

import subprocess

p = subprocess.Popen('ls', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
for line in p.stdout.readlines():
    print line,
retval = p.wait()
You are free to do what you want with the stdout data in the pipe. In fact, you can simply omit those parameters (stdout= and stderr=) and it'll behave like os.system().


引用信息

以下是[Python库 subprocess/Popen]所有用到的引用信息,向这些伟大的家伙致敬:
  1. ^ 1.0 1.1 Calling an external command in Python - Stack Overflow, 见识于2013-12-15 22:22