Skip to content

Instantly share code, notes, and snippets.

@motleytech
motleytech / runCmdAndGetOutput.py
Created April 13, 2016 23:37
Python snippet to run external command and get output
import subprocess
def runCommandAndGetOuput(command):
proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
(stdoutdata, stderrdata) = proc.communicate()
return stdoutdata