Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Look at the <a href="https://docs.python.org/2/library/subprocess.html" rel="noreferrer">subprocess module</a> in the standard library:</p> <pre><code>from subprocess import call call(["ls", "-l"]) </code></pre> <p>The advantage of <strong>subprocess</strong> vs. <strong>system</strong> is that it is more flexible (you can get the stdout, stderr, the "real" status code, better error handling, etc...).</p> <p>The <a href="https://docs.python.org/library/os.html#os.system" rel="noreferrer">official documentation</a> recommends the <strong>subprocess</strong> module over the alternative os.system():</p> <blockquote> <p>The <strong>subprocess</strong> module provides more powerful facilities for spawning new processes and retrieving their results; using that module is preferable to using this function [<a href="https://docs.python.org/library/os.html#os.system" rel="noreferrer"><code>os.system()</code></a>].</p> </blockquote> <p>The "<a href="https://docs.python.org/2/library/subprocess.html#replacing-older-functions-with-the-subprocess-module" rel="noreferrer">Replacing Older Functions with the subprocess Module</a>" section in the <strong>subprocess</strong> documentation may have some helpful recipes.</p> <p>Official documentation on the <strong>subprocess</strong> module:</p> <ul> <li><a href="https://docs.python.org/2/library/subprocess.html#module-subprocess" rel="noreferrer">Python 2 - subprocess</a></li> <li><a href="https://docs.python.org/3/library/subprocess.html#module-subprocess" rel="noreferrer">Python 3 - subprocess</a></li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload