File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -1626,13 +1626,13 @@ from pathlib import Path
1626
1626
```
1627
1627
1628
1628
``` python
1629
- < str > = str ( < Path> ) # Returns Path as a string .
1630
- < file > = open ( < Path> ) # Opens the file and returns a file object .
1629
+ < iter > = < Path> .iterdir( ) # Returns dir contents as Path objects .
1630
+ < iter > = < Path> .glob( ' <pattern> ' ) # Returns Paths matching the wildcard pattern .
1631
1631
```
1632
1632
1633
1633
``` python
1634
- < iter > = < Path> .iterdir( ) # Returns dir contents as Path objects .
1635
- < iter > = < Path> .glob( ' <pattern> ' ) # Returns Paths matching the wildcard pattern .
1634
+ < str > = str ( < Path> ) # Returns path as a string .
1635
+ < file > = open ( < Path> ) # Opens the file and returns a file object .
1636
1636
```
1637
1637
1638
1638
Original file line number Diff line number Diff line change 1486
1486
<str> = <Path>.suffix < span class ="hljs-comment "> # Returns final component's extension.</ span >
1487
1487
<tup.> = <Path>.parts < span class ="hljs-comment "> # Returns all components as strings.</ span >
1488
1488
</ code > </ pre >
1489
- < pre > < code class ="python language-python hljs "> <str> = str(<Path>) < span class ="hljs-comment "> # Returns Path as a string.</ span >
1490
- <file> = open(<Path>) < span class ="hljs-comment "> # Opens the file and returns a file object.</ span >
1491
- </ code > </ pre >
1492
1489
< pre > < code class ="python language-python hljs "> <iter> = <Path>.iterdir() < span class ="hljs-comment "> # Returns dir contents as Path objects.</ span >
1493
1490
<iter> = <Path>.glob(< span class ="hljs-string "> '<pattern>'</ span > ) < span class ="hljs-comment "> # Returns Paths matching the wildcard pattern.</ span >
1494
1491
</ code > </ pre >
1492
+ < pre > < code class ="python language-python hljs "> <str> = str(<Path>) < span class ="hljs-comment "> # Returns path as a string.</ span >
1493
+ <file> = open(<Path>) < span class ="hljs-comment "> # Opens the file and returns a file object.</ span >
1494
+ </ code > </ pre >
1495
1495
< div > < h2 id ="oscommands "> < a href ="#oscommands " name ="oscommands "> #</ a > OS Commands</ h2 > < div > < h3 id ="filesanddirectories "> Files and Directories</ h3 > < ul >
1496
1496
< li > < strong > Paths can be either strings, Paths, or DirEntry objects.</ strong > </ li >
1497
1497
< li > < strong > Functions report OS related errors by raising either OSError or one of its < a href ="#exceptions-1 "> subclasses</ a > .</ strong > </ li >
You can’t perform that action at this time.
0 commit comments