To use pipe from the shell.python
from subprocess import runrun('grep something', data=run.stdin)
$ ps aux | python script.py