Browse Source

Paths

pull/122/head
Jure Šorn 2 years ago
parent
commit
9af8d0b2cb
2 changed files with 4 additions and 4 deletions
  1. 4
      README.md
  2. 4
      index.html

4
README.md

@ -1645,7 +1645,7 @@ from os import scandir
<iter> = scandir(path='.') # Returns DirEntry objects located at path.
<str> = <DirEntry>.path # Returns whole path as a string.
<str> = <DirEntry>.name # Returns final component as a string.
<file> = open(<DirEntry>) # Opens the file and returns file object.
<file> = open(<DirEntry>) # Opens the file and returns a file object.
```
### Path Object
@ -1680,7 +1680,7 @@ from pathlib import Path
```python
<str> = str(<Path>) # Returns path as a string.
<file> = open(<Path>) # Opens the file and returns file object.
<file> = open(<Path>) # Opens the file and returns a file object.
```

4
index.html

@ -1394,7 +1394,7 @@ value = args.&lt;name&gt;
<pre><code class="python language-python hljs">&lt;iter&gt; = scandir(path=<span class="hljs-string">'.'</span>) <span class="hljs-comment"># Returns DirEntry objects located at path.</span>
&lt;str&gt; = &lt;DirEntry&gt;.path <span class="hljs-comment"># Returns 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 file object.</span>
&lt;file&gt; = open(&lt;DirEntry&gt;) <span class="hljs-comment"># Opens the file and returns a file object.</span>
</code></pre>
<div><h3 id="pathobject">Path Object</h3><pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> pathlib <span class="hljs-keyword">import</span> Path
</code></pre></div>
@ -1417,7 +1417,7 @@ value = args.&lt;name&gt;
&lt;iter&gt; = &lt;Path&gt;.glob(<span class="hljs-string">'&lt;pattern&gt;'</span>) <span class="hljs-comment"># Returns Paths matching the wildcard pattern.</span>
</code></pre>
<pre><code class="python language-python hljs">&lt;str&gt; = str(&lt;Path&gt;) <span class="hljs-comment"># Returns path as a string.</span>
&lt;file&gt; = open(&lt;Path&gt;) <span class="hljs-comment"># Opens the file and returns file object.</span>
&lt;file&gt; = open(&lt;Path&gt;) <span class="hljs-comment"># Opens the file and returns a file object.</span>
</code></pre>
<div><h2 id="oscommands"><a href="#oscommands" name="oscommands">#</a>OS Commands</h2><div><h3 id="filesanddirectories">Files and Directories</h3><ul>
<li><strong>Paths can be either strings, Paths or DirEntry objects.</strong></li>

Loading…
Cancel
Save