title: Difference between os.system("cmd") and commands.getoutput("cmd") ...?
body: <p>I'm trying to print today's date using <code>os.sytem</code> and <code>commands.getoutput</code> using python.</p>
  
  <p>My code is : 
  <code><pre>
      import os, commands<br>
      print os.system("date +%Y%m%d%T")
      print commands.getoutput("date +%Y%m%d%T")
  </code></pre></p>
  
  <p>=========Ouput :-=============</p>
  
  <p><strong>Case 1:</strong> </p>
  
  <p><code>./test.py</code></p>
  
  <p>First print statement's O/P: 
  <code>
  2014071713:25:21
  0
  </code><br>
  Second print statement's O/P:<br>
  <code>2014071713:25:21</code></p>
  
  <p><strong>Case 2:</strong><br>
  I tried trace using <code>import pdb;pdb.set_trace()</code>
  <code><pre>
      print os.system("date +%Y%m%d%T")
      (Pdb) n
      2014071713:25:21
      0<br>
      print commands.getoutput("date +%Y%m%d%T")
      (Pdb) n
      2014071713:31:29
      --Return--
  </pre></code></p>
  
  <p>Why first <code>print</code> statement appending <code>0</code> in both the cases and second <code>print</code> statement is not appending anything in <code>case 1</code> but it is appending <code>--Return--</code> in <code>case 2</code> ?</p>
  
  <p>I know there are some modules for <code>date / time</code> in python but I want know why it is appending those extra strings in output ?</p>