Running shell command and capturing the output
In all officially maintained versions of Python, the simplest approach is to use the subprocess.check_output function: check_output runs a single program that takes only arguments as input.1 It returns the result exactly as printed to stdout. If you need to write input to stdin, skip ahead to the run or Popen sections. If you want … Read more