Reputation: 45
Please help to achieve output of shell in python
Upvotes: 1
Views: 5083
Reputation: 4691
You can hook up stdin and stdout of processes together in python using Popen but it's usually easiest to let shell shell do the work, for example you can:
subprocess.check_output('ls | grep something', shell=True)
Related: How do I use subprocess.Popen to connect multiple processes by pipes?
Upvotes: 2