Browse Source

List, Paths

pull/102/merge
Jure Šorn 1 month ago
parent
commit
5328b93413
2 changed files with 6 additions and 6 deletions
  1. 4
      README.md
  2. 8
      index.html

4
README.md

@ -29,7 +29,7 @@ if __name__ == '__main__': # Skips next line if file was imported.
List
----
```python
<list> = [<el_1>, <el_2>, ...] # Creates new list. Also list(<collection>).
<list> = [<el_1>, <el_2>, ...] # Creates a list object. Also list(<collection>).
```
```python
@ -1664,7 +1664,7 @@ from pathlib import Path
<iter> = os.scandir(path='.') # Returns DirEntry objects located at the path.
<str> = <DirEntry>.path # Returns the whole path as a string.
<str> = <DirEntry>.name # Returns final component as a string.
<file> = open(<DirEntry>) # Opens the file and returns a file object.
<file> = open(<DirEntry>) # Opens the file and returns its file object.
```
### Path Object

8
index.html

@ -56,7 +56,7 @@
<body>
<header>
<aside>May 2, 2025</aside>
<aside>May 3, 2025</aside>
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
</header>
@ -111,7 +111,7 @@ const browser_prefers_dark = window.matchMedia('(prefers-color-scheme: dark)').m
main() <span class="hljs-comment"># Runs `def main(): ...` function.</span>
</code></pre></div>
<div><h2 id="list"><a href="#list" name="list">#</a>List</h2><pre><code class="python language-python hljs">&lt;list&gt; = [&lt;el_1&gt;, &lt;el_2&gt;, ...] <span class="hljs-comment"># Creates new list. Also list(&lt;collection&gt;).</span>
<div><h2 id="list"><a href="#list" name="list">#</a>List</h2><pre><code class="python language-python hljs">&lt;list&gt; = [&lt;el_1&gt;, &lt;el_2&gt;, ...] <span class="hljs-comment"># Creates a list object. Also list(&lt;collection&gt;).</span>
</code></pre></div>
<pre><code class="python language-python hljs">&lt;el&gt; = &lt;list&gt;[index] <span class="hljs-comment"># First index is 0. Last -1. Allows assignments.</span>
@ -1414,7 +1414,7 @@ args = p.parse_args() <span class="h
<div><h3 id="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><code class="python language-python hljs">&lt;iter&gt; = os.scandir(path=<span class="hljs-string">'.'</span>) <span class="hljs-comment"># Returns DirEntry objects located at the path.</span>
&lt;str&gt; = &lt;DirEntry&gt;.path <span class="hljs-comment"># Returns the whole path as a string.</span>
&lt;str&gt; = &lt;DirEntry&gt;.name <span class="hljs-comment"># Returns final component as a string.</span>
&lt;file&gt; = open(&lt;DirEntry&gt;) <span class="hljs-comment"># Opens the file and returns a file object.</span>
&lt;file&gt; = open(&lt;DirEntry&gt;) <span class="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
<footer>
<aside>May 2, 2025</aside>
<aside>May 3, 2025</aside>
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
</footer>

Loading…
Cancel
Save