Last active
August 29, 2015 14:21
-
-
Save vik-y/e4d936e710b0042a1673 to your computer and use it in GitHub Desktop.
Run shell command and capture output using python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def run_terminal(command): | |
| p = subprocess.Popen(command.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |
| out, err = p.communicate() | |
| return out |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
use os.system("command") instead if you just want to execute a command and don't care about the output.