<pre><codeclass="python language-python hljs"><file>.write(<str/bytes>) <spanclass="hljs-comment"># Writes a string or bytes object.</span>
<file>.writelines(<collection>) <spanclass="hljs-comment"># Writes a coll. of strings or bytes objects.</span>
<file>.flush() <spanclass="hljs-comment"># Flushes write buffer. Runs every 4096/8192 B.</span>
<file>.close() <spanclass="hljs-comment"># Closes the file after flushing.</span>
<file>.close() <spanclass="hljs-comment"># Closes the file after flushing write buffer.</span>
</code></pre>
<ul>
<li><strong>Methods do not add or strip trailing newlines, not even writelines().</strong></li>