<div><h2id="list"><ahref="#list"name="list">#</a>List</h2><pre><codeclass="python language-python hljs"><list> = [<el_1>, <el_2>, ...] <spanclass="hljs-comment"># Creates new list. Also list(<collection>).</span>
<div><h2id="list"><ahref="#list"name="list">#</a>List</h2><pre><codeclass="python language-python hljs"><list> = [<el_1>, <el_2>, ...] <spanclass="hljs-comment"># Creates a list object. Also list(<collection>).</span>
</code></pre></div>
<pre><codeclass="python language-python hljs"><el> = <list>[index] <spanclass="hljs-comment"># First index is 0. Last -1. Allows assignments.</span>
<div><h3id="direntry">DirEntry</h3><p><strong>Unlike listdir(), scandir() returns DirEntry objects that cache isfile, isdir, and on Windows also stat information, thus significantly increasing the performance of code that requires it.</strong></p><pre><codeclass="python language-python hljs"><iter> = os.scandir(path=<spanclass="hljs-string">'.'</span>) <spanclass="hljs-comment"># Returns DirEntry objects located at the path.</span>
<str> = <DirEntry>.path <spanclass="hljs-comment"># Returns the whole path as a string.</span>
<str> = <DirEntry>.name <spanclass="hljs-comment"># Returns final component as a string.</span>
<file> = open(<DirEntry>) <spanclass="hljs-comment"># Opens the file and returns a file object.</span>
<file> = open(<DirEntry>) <spanclass="hljs-comment"># Opens the file and returns its file object.</span>
</code></pre></div>
@ -2940,7 +2940,7 @@ $ deactivate <span class="hljs-comment"># Deactivates the active