Browse Source

Working on path

pull/46/head
Jure Šorn 4 years ago
parent
commit
159e2d4602
2 changed files with 10 additions and 10 deletions
  1. 10
      README.md
  2. 10
      index.html

10
README.md

@ -1593,14 +1593,14 @@ from pathlib import Path
``` ```
```python ```python
<Path> = Path() # Or: Path('.')
<Path> = Path.cwd() # Returns the absolute cwd.
<Path> = <Path>.resolve() # Returns the absolute Path without symlinks.
<Path> = <Path>.parent # Returns Path without final component.
<Path> = Path() # Returns relative cwd. Also Path('.').
<Path> = Path.cwd() # Returns absolute cwd. Also Path().resolve().
<Path> = <Path>.resolve() # Returns absolute Path without symlinks.
``` ```
```python ```python
<str> = <Path>.name # Returns final component.
<Path> = <Path>.parent # Returns Path without final component.
<str> = <Path>.name # Returns final component as string.
<str> = <Path>.stem # Returns final component without extension. <str> = <Path>.stem # Returns final component without extension.
<str> = <Path>.suffix # Returns final component's extension. <str> = <Path>.suffix # Returns final component's extension.
<tup.> = <Path>.parts # Returns all components as strings. <tup.> = <Path>.parts # Returns all components as strings.

10
index.html

@ -1464,12 +1464,12 @@ value = args.&lt;name&gt;
<pre><code class="python language-python hljs">&lt;Path&gt; = Path(&lt;path&gt; [, ...]) <span class="hljs-comment"># Accepts strings, Paths and DirEntry objects.</span> <pre><code class="python language-python hljs">&lt;Path&gt; = Path(&lt;path&gt; [, ...]) <span class="hljs-comment"># Accepts strings, Paths and DirEntry objects.</span>
&lt;Path&gt; = &lt;path&gt; / &lt;path&gt; [/ ...] <span class="hljs-comment"># One of the paths must be a Path object.</span> &lt;Path&gt; = &lt;path&gt; / &lt;path&gt; [/ ...] <span class="hljs-comment"># One of the paths must be a Path object.</span>
</code></pre> </code></pre>
<pre><code class="python language-python hljs">&lt;Path&gt; = Path() <span class="hljs-comment"># Or: Path('.')</span>
&lt;Path&gt; = Path.cwd() <span class="hljs-comment"># Returns the absolute cwd.</span>
&lt;Path&gt; = &lt;Path&gt;.resolve() <span class="hljs-comment"># Returns the absolute Path without symlinks.</span>
&lt;Path&gt; = &lt;Path&gt;.parent <span class="hljs-comment"># Returns Path without final component.</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; = &lt;Path&gt;.resolve() <span class="hljs-comment"># Returns absolute Path without symlinks.</span>
</code></pre> </code></pre>
<pre><code class="python language-python hljs">&lt;str&gt; = &lt;Path&gt;.name <span class="hljs-comment"># Returns final component.</span>
<pre><code class="python language-python hljs">&lt;Path&gt; = &lt;Path&gt;.parent <span class="hljs-comment"># Returns Path without final component.</span>
&lt;str&gt; = &lt;Path&gt;.name <span class="hljs-comment"># Returns final component as 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;.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;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;tup.&gt; = &lt;Path&gt;.parts <span class="hljs-comment"># Returns all components as strings.</span>

Loading…
Cancel
Save