To use pipe from the shell.
from subprocess import runrun('grep something', data=run.stdin)
$ ps aux | python script.py
To use pipe from the shell.
from subprocess import runrun('grep something', data=run.stdin)
$ ps aux | python script.py
转载于:https://my.oschina.net/u/2245485/blog/474635