</ul><div><h3id="fileobject">File Object</h3><pre><codeclass="python language-python hljs"><file>.seek(<spanclass="hljs-number">0</span>) <spanclass="hljs-comment"># Moves to the start of the file.</span>
<file>.seek(offset) <spanclass="hljs-comment"># Moves 'offset' chars/bytes from the start.</span>
<file>.seek(<spanclass="hljs-number">0</span>, <spanclass="hljs-number">2</span>) <spanclass="hljs-comment"># Moves to the end of the file.</span>
<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="sends11tothebasiccalculatorandcapturesitsoutput">Sends '1 + 1' to the basic 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="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
<div><h4id="sendstestintothebasiccalculatorrunninginstandardmodeandsavesitsoutputtotestout">Sends test.in to the basic 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
<li><strong>File must be opened with <codeclass="python hljs"><spanclass="hljs-string">'newline=""'</span></code> argument, or an extra '\r' will be added to every '\n' on platforms that use '\r\n' line endings!</strong></li>
<li><strong>File must be opened with <codeclass="python hljs"><spanclass="hljs-string">'newline=""'</span></code> argument, or '\r' will be added in frontof every '\n' on platforms that use '\r\n' line endings!</strong></li>
</ul>
<div><h3id="parameters">Parameters</h3><ul>
<li><strong><codeclass="python hljs"><spanclass="hljs-string">'dialect'</span></code> - Master parameter that sets the default values.</strong></li>