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
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
Original file line number Diff line number Diff line change 15181518</ code > </ pre >
15191519< pre > < code class ="python language-python hljs "> <Path> = Path() < span class ="hljs-comment "> # Returns relative cwd. Also Path('.').</ span >
15201520<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 >
15221521<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 >
15231523</ code > </ pre >
15241524< pre > < code class ="python language-python hljs "> <Path> = <Path>.parent < span class ="hljs-comment "> # Returns Path without final component.</ span >
15251525<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