File tree Expand file tree Collapse file tree 2 files changed +2
-2
lines changed Expand file tree Collapse file tree 2 files changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -1640,8 +1640,8 @@ from pathlib import Path
1640
1640
``` python
1641
1641
< Path> = Path() # Returns relative cwd. Also Path('.').
1642
1642
< Path> = Path.cwd() # Returns absolute cwd. Also Path().resolve().
1643
- < Path> = < Path> .resolve() # Returns absolute Path without symlinks.
1644
1643
< Path> = Path.home() # Returns user's home directory.
1644
+ < Path> = Path(__file__ ).resolve() # Returns script's path if cwd wasn't changed.
1645
1645
```
1646
1646
1647
1647
``` python
Original file line number Diff line number Diff line change 1518
1518
</ code > </ pre >
1519
1519
< pre > < code class ="python language-python hljs "> <Path> = Path() < span class ="hljs-comment "> # Returns relative cwd. Also Path('.').</ span >
1520
1520
<Path> = Path.cwd() < span class ="hljs-comment "> # Returns absolute cwd. Also Path().resolve().</ span >
1521
- <Path> = <Path>.resolve() < span class ="hljs-comment "> # Returns absolute Path without symlinks.</ span >
1522
1521
<Path> = Path.home() < span class ="hljs-comment "> # Returns user's home directory.</ span >
1522
+ <Path> = Path(__file__).resolve() < span class ="hljs-comment "> # Returns script's path if cwd wasn't changed.</ span >
1523
1523
</ code > </ pre >
1524
1524
< pre > < code class ="python language-python hljs "> <Path> = <Path>.parent < span class ="hljs-comment "> # Returns Path without final component.</ span >
1525
1525
<str> = <Path>.name < span class ="hljs-comment "> # Returns final component as a string.</ span >
You can’t perform that action at this time.
0 commit comments