title: python + how to verify if linux command success in python
body: <p>How to capture the standard output of command in python script</p>
  
  <p>for example , I want to check if tar command success or not
  and results will be return in stndStatus value</p>
  
  <pre><code>import commands
  
  def runCommandAndReturnValue():
  
        status,output = commands.getstatusoutput("  tar xvf Test.tar ")
        return stndStatus
  </code></pre>
  
  <p>other example -  its like $? in shell scripts so stndStatus will be the value of $?</p>