<pre><codeclass="python language-python hljs"><str/bytes> = <file>.read(size=<spanclass="hljs-number">-1</span>) <spanclass="hljs-comment"># Reads 'size' chars/bytes or until EOF.</span>
<pre><codeclass="python language-python hljs"><str/bytes> = <file>.read(size=<spanclass="hljs-number">-1</span>) <spanclass="hljs-comment"># Reads 'size' chars/bytes or until EOF.</span>
<str/bytes> = <file>.readline() <spanclass="hljs-comment"># Returns a line.</span>
<list> = <file>.readlines() <spanclass="hljs-comment"># Returns a list of lines.</span>
<str/bytes> = <file>.readline() <spanclass="hljs-comment"># Returns a line or empty string on EOF.</span>
<list> = <file>.readlines() <spanclass="hljs-comment"># Returns a list of lines or empty list.</span>
<str/bytes> = next(<file>) <spanclass="hljs-comment"># Returns a line using buffer. Do not mix.</span>
<str/bytes> = next(<file>) <spanclass="hljs-comment"># Returns a line using buffer. Do not mix.</span>
</code></pre>
</code></pre>
<pre><codeclass="python language-python hljs"><file>.write(<str/bytes>) <spanclass="hljs-comment"># Writes a string or bytes object.</span>
<pre><codeclass="python language-python hljs"><file>.write(<str/bytes>) <spanclass="hljs-comment"># Writes a string or bytes object.</span>