<div><h4id="sends11toacalculatorandcapturesitsoutput">Sends '1 + 1' to a calculator and captures its output:</h4><pre><codeclass="python language-python hljs"><spanclass="hljs-meta">>>></span><spanclass="hljs-keyword">from</span> subprocess <spanclass="hljs-keyword">import</span> run
<div><h4id="sends11tothecalculatorandcapturesitsoutput">Sends '1 + 1' to the calculator and captures its output:</h4><pre><codeclass="python language-python hljs"><spanclass="hljs-meta">>>></span><spanclass="hljs-keyword">from</span> subprocess <spanclass="hljs-keyword">import</span> run
<div><h4id="sendstestintoacalculatorrunninginstandardmodeandsavesitsoutputtotestout">Sends 'test.in' to a calculator running in standard mode and saves its output to 'test.out':</h4><pre><codeclass="python language-python hljs"><spanclass="hljs-meta">>>></span><spanclass="hljs-keyword">from</span> shlex <spanclass="hljs-keyword">import</span> split
<div><h4id="sendstestintothecalculatorrunninginstandardmodeandsavesitsoutputtotestout">Sends 'test.in' to the calculator running in standard mode and saves its output to 'test.out':</h4><pre><codeclass="python language-python hljs"><spanclass="hljs-meta">>>></span><spanclass="hljs-keyword">from</span> shlex <spanclass="hljs-keyword">import</span> split