Created
April 13, 2016 23:37
-
-
Save motleytech/4f3b3e4e09b7b6248c7e7c1eef64e28f to your computer and use it in GitHub Desktop.
Python snippet to run external command and get output
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
import subprocess | |
def runCommandAndGetOuput(command): | |
proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE) | |
(stdoutdata, stderrdata) = proc.communicate() | |
return stdoutdata |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment