Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit de13783

Browse files
committed
Path
1 parent b0d1b5c commit de13783

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1640,8 +1640,8 @@ from pathlib import Path
16401640
```python
16411641
<Path> = Path() # Returns relative cwd. Also Path('.').
16421642
<Path> = Path.cwd() # Returns absolute cwd. Also Path().resolve().
1643-
<Path> = <Path>.resolve() # Returns absolute Path without symlinks.
16441643
<Path> = Path.home() # Returns user's home directory.
1644+
<Path> = Path(__file__).resolve() # Returns script's path if cwd wasn't changed.
16451645
```
16461646

16471647
```python

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1518,8 +1518,8 @@
15181518
</code></pre>
15191519
<pre><code class="python language-python hljs">&lt;Path&gt; = Path() <span class="hljs-comment"># Returns relative cwd. Also Path('.').</span>
15201520
&lt;Path&gt; = Path.cwd() <span class="hljs-comment"># Returns absolute cwd. Also Path().resolve().</span>
1521-
&lt;Path&gt; = &lt;Path&gt;.resolve() <span class="hljs-comment"># Returns absolute Path without symlinks.</span>
15221521
&lt;Path&gt; = Path.home() <span class="hljs-comment"># Returns user's home directory.</span>
1522+
&lt;Path&gt; = Path(__file__).resolve() <span class="hljs-comment"># Returns script's path if cwd wasn't changed.</span>
15231523
</code></pre>
15241524
<pre><code class="python language-python hljs">&lt;Path&gt; = &lt;Path&gt;.parent <span class="hljs-comment"># Returns Path without final component.</span>
15251525
&lt;str&gt; = &lt;Path&gt;.name <span class="hljs-comment"># Returns final component as a string.</span>

0 commit comments

Comments
 (0)