* **Use `'file=sys.stderr'` for messages about errors.**
* **Use `'file=sys.stderr'` for messages about errors.**
* **Use `'flush=True'` to forcibly flush the stream.**
* **Stdout and stderr streams hold output in a buffer until they receive a string containing '\n' or '\r', buffer reaches 4096 characters, `'flush=True'` is used, or program exits.**
@ -1282,21 +1282,21 @@ sys.exit(<int>) <span class="hljs-comment"># Exits with
<ul>
<ul>
<li><strong>Use <codeclass="python hljs"><spanclass="hljs-string">'file=sys.stderr'</span></code> for messages about errors.</strong></li>
<li><strong>Use <codeclass="python hljs"><spanclass="hljs-string">'file=sys.stderr'</span></code> for messages about errors.</strong></li>
<li><strong>Use<codeclass="python hljs"><spanclass="hljs-string">'flush=True'</span></code>to forcibly flush the stream.</strong></li>
<li><strong>Stdout and stderr streams hold output in a buffer until they receive a string containing '\n' or '\r', buffer reaches 4096 characters,<codeclass="python hljs"><spanclass="hljs-string">'flush=True'</span></code>is used, or program exits.</strong></li>
<li><strong>Levels deeper than 'depth' get replaced by '…'.</strong></li>
<li><strong>Each item is printed on its own line if collection takes up more than 'width' characters.</strong></li>
<li><strong>Nested collections that are 'depth' levels deep get printed as '…'.</strong></li>
</ul>
</ul>
<div><h2id="input"><ahref="#input"name="input">#</a>Input</h2><p><strong>Reads a line from the user input or pipe if present.</strong></p><pre><codeclass="python language-python hljs"><str> = input(prompt=<spanclass="hljs-keyword">None</span>)
p = ArgumentParser(description=<str>)<spanclass="hljs-comment"># Returns a parser.</span>
p.add_argument(<spanclass="hljs-string">'-<short_name>'</span>, <spanclass="hljs-string">'--<name>'</span>, action=<spanclass="hljs-string">'store_true'</span>) <spanclass="hljs-comment"># Flag (defaults to False).</span>
p.add_argument(<spanclass="hljs-string">'-<short_name>'</span>, <spanclass="hljs-string">'--<name>'</span>, type=<type>) <spanclass="hljs-comment"># Option (defaults to None).</span>
p.add_argument(<spanclass="hljs-string">'<name>'</span>, type=<type>, nargs=<spanclass="hljs-number">1</span>) <spanclass="hljs-comment"># Mandatory first argument.</span>
<li><strong>Use <codeclass="python hljs"><spanclass="hljs-string">'help=<str>'</span></code> to set argument description that will be displayed in help message.</strong></li>
<li><strong>Use <codeclass="python hljs"><spanclass="hljs-string">'help=<str>'</span></code> to set argument description that will be displayed in help message.</strong></li>
<li><strong>Use <codeclass="python hljs"><spanclass="hljs-string">'default=<el>'</span></code> to set argument's default value.</strong></li>
<li><strong>Use <codeclass="python hljs"><spanclass="hljs-string">'default=<el>'</span></code> to set option's default value.</strong></li>
<li><strong>Use <codeclass="python hljs"><spanclass="hljs-string">'type=FileType(<mode>)'</span></code> for files. Accepts 'encoding', but 'newline' is None.</strong></li>
<li><strong>Use <codeclass="python hljs"><spanclass="hljs-string">'type=FileType(<mode>)'</span></code> for files. Accepts 'encoding', but 'newline' is None.</strong></li>
</ul>
</ul>
<div><h2id="open"><ahref="#open"name="open">#</a>Open</h2><p><strong>Opens the file and returns a corresponding file object.</strong></p><pre><codeclass="python language-python hljs"><file> = open(<path>, mode=<spanclass="hljs-string">'r'</span>, encoding=<spanclass="hljs-keyword">None</span>, newline=<spanclass="hljs-keyword">None</span>)
<div><h2id="open"><ahref="#open"name="open">#</a>Open</h2><p><strong>Opens the file and returns a corresponding file object.</strong></p><pre><codeclass="python language-python hljs"><file> = open(<path>, mode=<spanclass="hljs-string">'r'</span>, encoding=<spanclass="hljs-keyword">None</span>, newline=<spanclass="hljs-keyword">None</span>)