Jure Šorn 1 day ago
parent
commit
fa8a4c60e8
2 changed files with 8 additions and 8 deletions
  1. 8
      README.md
  2. 8
      index.html

8
README.md

@ -1685,15 +1685,15 @@ from pathlib import Path
<Path> = Path() # Returns relative CWD. Also Path('.'). <Path> = Path() # Returns relative CWD. Also Path('.').
<Path> = Path.cwd() # Returns absolute CWD. Also Path().resolve(). <Path> = Path.cwd() # Returns absolute CWD. Also Path().resolve().
<Path> = Path.home() # Returns user's home directory (absolute). <Path> = Path.home() # Returns user's home directory (absolute).
<Path> = Path(__file__).resolve() # Returns script's path if CWD wasn't changed.
<Path> = Path(__file__).resolve() # Returns module's path if CWD wasn't changed.
``` ```
```python ```python
<Path> = <Path>.parent # Returns Path without the final component. <Path> = <Path>.parent # Returns Path without the final component.
<str> = <Path>.name # Returns final component as a string. <str> = <Path>.name # Returns final component as a string.
<str> = <Path>.stem # Returns final component without extension.
<str> = <Path>.suffix # Returns final component's extension.
<tup.> = <Path>.parts # Returns all components as strings.
<str> = <Path>.stem # Returns final component w/o last extension.
<str> = <Path>.suffix # Returns last extension prepended with a dot.
<tup.> = <Path>.parts # Returns all path's components as strings.
``` ```
```python ```python

8
index.html

@ -1427,13 +1427,13 @@ args = p.parse_args() <span class="h
<pre><code class="python language-python hljs">&lt;Path&gt; = Path() <span class="hljs-comment"># Returns relative CWD. Also Path('.').</span> <pre><code class="python language-python hljs">&lt;Path&gt; = Path() <span class="hljs-comment"># Returns relative CWD. Also Path('.').</span>
&lt;Path&gt; = Path.cwd() <span class="hljs-comment"># Returns absolute CWD. Also Path().resolve().</span> &lt;Path&gt; = Path.cwd() <span class="hljs-comment"># Returns absolute CWD. Also Path().resolve().</span>
&lt;Path&gt; = Path.home() <span class="hljs-comment"># Returns user's home directory (absolute).</span> &lt;Path&gt; = Path.home() <span class="hljs-comment"># Returns user's home directory (absolute).</span>
&lt;Path&gt; = Path(__file__).resolve() <span class="hljs-comment"># Returns script's path if CWD wasn't changed.</span>
&lt;Path&gt; = Path(__file__).resolve() <span class="hljs-comment"># Returns module's path if CWD wasn't changed.</span>
</code></pre> </code></pre>
<pre><code class="python language-python hljs">&lt;Path&gt; = &lt;Path&gt;.parent <span class="hljs-comment"># Returns Path without the final component.</span> <pre><code class="python language-python hljs">&lt;Path&gt; = &lt;Path&gt;.parent <span class="hljs-comment"># Returns Path without the final component.</span>
&lt;str&gt; = &lt;Path&gt;.name <span class="hljs-comment"># Returns final component as a string.</span> &lt;str&gt; = &lt;Path&gt;.name <span class="hljs-comment"># Returns final component as a string.</span>
&lt;str&gt; = &lt;Path&gt;.stem <span class="hljs-comment"># Returns final component without extension.</span>
&lt;str&gt; = &lt;Path&gt;.suffix <span class="hljs-comment"># Returns final component's extension.</span>
&lt;tup.&gt; = &lt;Path&gt;.parts <span class="hljs-comment"># Returns all components as strings.</span>
&lt;str&gt; = &lt;Path&gt;.stem <span class="hljs-comment"># Returns final component w/o last extension.</span>
&lt;str&gt; = &lt;Path&gt;.suffix <span class="hljs-comment"># Returns last extension prepended with a dot.</span>
&lt;tup.&gt; = &lt;Path&gt;.parts <span class="hljs-comment"># Returns all path's components as strings.</span>
</code></pre> </code></pre>
<pre><code class="python language-python hljs">&lt;iter&gt; = &lt;Path&gt;.iterdir() <span class="hljs-comment"># Returns directory contents as Path objects.</span> <pre><code class="python language-python hljs">&lt;iter&gt; = &lt;Path&gt;.iterdir() <span class="hljs-comment"># Returns directory contents as Path objects.</span>
&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> &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>

Loading…
Cancel
Save