Using the subprocess module in Python
<p>I have written this simple Python script that finds the current date and time:</p>

<pre><code>import subprocess 
time = subprocess.Popen('date')
print 'It is ', str(time)
</code></pre>

<p>When I run the program, I get the following:</p>

<pre><code>It is  &lt;subprocess.Popen object at 0x106fe6ad0&gt;
Tue May 24 17:55:45 CEST 2016
</code></pre>

<p>How can I get rid of this part in the output? <code>&lt;subprocess.Popen object at 0x106fe6ad0&gt;</code></p>

<p>On the other hand, if I use <code>call()</code>, as follows:</p>

<pre><code>from subprocess import call 
time = call('date')
print 'It is ', str(time)
</code></pre>

<p>I get:</p>

<pre><code>Tue May 24 17:57:29 CEST 2016
It is  0
</code></pre>

<p>How can I get the <code>Tue May 24 17:57:29 CEST 2016</code> come in place of <code>0</code>. And, why do we get <code>0</code> in the first hand?</p>

<p>Thanks.</p>