File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -1645,7 +1645,7 @@ from os import scandir
1645
1645
< iter > = scandir(path = ' .' ) # Returns DirEntry objects located at path.
1646
1646
< str > = < DirEntry> .path # Returns whole path as a string.
1647
1647
< str > = < DirEntry> .name # Returns final component as a string.
1648
- < file > = open (< DirEntry> ) # Opens the file and returns file object.
1648
+ < file > = open (< DirEntry> ) # Opens the file and returns a file object.
1649
1649
```
1650
1650
1651
1651
### Path Object
@@ -1680,7 +1680,7 @@ from pathlib import Path
1680
1680
1681
1681
``` python
1682
1682
< str > = str (< Path> ) # Returns path as a string.
1683
- < file > = open (< Path> ) # Opens the file and returns file object.
1683
+ < file > = open (< Path> ) # Opens the file and returns a file object.
1684
1684
```
1685
1685
1686
1686
Original file line number Diff line number Diff line change 1394
1394
< pre > < code class ="python language-python hljs "> <iter> = scandir(path=< span class ="hljs-string "> '.'</ span > ) < span class ="hljs-comment "> # Returns DirEntry objects located at path.</ span >
1395
1395
<str> = <DirEntry>.path < span class ="hljs-comment "> # Returns whole path as a string.</ span >
1396
1396
<str> = <DirEntry>.name < span class ="hljs-comment "> # Returns final component as a string.</ span >
1397
- <file> = open(<DirEntry>) < span class ="hljs-comment "> # Opens the file and returns file object.</ span >
1397
+ <file> = open(<DirEntry>) < span class ="hljs-comment "> # Opens the file and returns a file object.</ span >
1398
1398
</ code > </ pre >
1399
1399
< div > < h3 id ="pathobject "> Path Object</ h3 > < pre > < code class ="python language-python hljs "> < span class ="hljs-keyword "> from</ span > pathlib < span class ="hljs-keyword "> import</ span > Path
1400
1400
</ code > </ pre > </ div >
1417
1417
<iter> = <Path>.glob(< span class ="hljs-string "> '<pattern>'</ span > ) < span class ="hljs-comment "> # Returns Paths matching the wildcard pattern.</ span >
1418
1418
</ code > </ pre >
1419
1419
< pre > < code class ="python language-python hljs "> <str> = str(<Path>) < span class ="hljs-comment "> # Returns path as a string.</ span >
1420
- <file> = open(<Path>) < span class ="hljs-comment "> # Opens the file and returns file object.</ span >
1420
+ <file> = open(<Path>) < span class ="hljs-comment "> # Opens the file and returns a file object.</ span >
1421
1421
</ code > </ pre >
1422
1422
< div > < h2 id ="oscommands "> < a href ="#oscommands " name ="oscommands "> #</ a > OS Commands</ h2 > < div > < h3 id ="filesanddirectories "> Files and Directories</ h3 > < ul >
1423
1423
< li > < strong > Paths can be either strings, Paths or DirEntry objects.</ strong > </ li >
You can’t perform that action at this time.
0 commit comments