title: How to store the return value of os.system that it has printed to stdout in python?
body: <p>I am writing a python script which checks for number of active connections for a particular IP / port. For this I use os.system( 'my_command') to grab the output. os.system returns the exit status of the command I've passed it (0 means the command returned without error).
  How can I store this value which os.system throws to STDOUT in a variable ? So that this variable can used later in the function for counter.
  Something like subprocess, os.popen can help. Can someone suggest ?</p>