Skip to content

Commit d6eb836

Browse files
committed
Path
1 parent fdf7a8a commit d6eb836

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1586,6 +1586,7 @@ cwd = Path()
15861586
```python
15871587
<Path> = <Path>.resolve() # Returns absolute path without symlinks.
15881588
<Path> = <Path>.parent # Returns path without final component.
1589+
<file> = open(<Path>) # Opens a file and returns file object.
15891590
```
15901591

15911592

@@ -1626,7 +1627,11 @@ os.mkdir(<path>, mode=0o777) # Creates a directory.
16261627
```python
16271628
<str> = <DirEntry>.path # Path as a string.
16281629
<str> = <DirEntry>.name # Final component.
1630+
```
1631+
1632+
```python
16291633
<Path> = Path(<DirEntry>) # Path object.
1634+
<file> = open(<DirEntry>) # File object.
16301635
```
16311636

16321637
### Shell Commands

index.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1441,6 +1441,7 @@
14411441
</code></pre>
14421442
<pre><code class="python language-python hljs">&lt;Path&gt; = &lt;Path&gt;.resolve() <span class="hljs-comment"># Returns absolute path without symlinks.</span>
14431443
&lt;Path&gt; = &lt;Path&gt;.parent <span class="hljs-comment"># Returns path without final component.</span>
1444+
&lt;file&gt; = open(&lt;Path&gt;) <span class="hljs-comment"># Opens a file and returns file object.</span>
14441445
</code></pre>
14451446
<div><h2 id="commandexecution"><a href="#commandexecution" name="commandexecution">#</a>Command Execution</h2><div><h3 id="filesanddirectories">Files and Directories</h3><ul>
14461447
<li><strong>Paths can be either strings or Path objects.</strong></li>
@@ -1468,7 +1469,9 @@
14681469

14691470
<pre><code class="python language-python hljs">&lt;str&gt; = &lt;DirEntry&gt;.path <span class="hljs-comment"># Path as a string.</span>
14701471
&lt;str&gt; = &lt;DirEntry&gt;.name <span class="hljs-comment"># Final component.</span>
1471-
&lt;Path&gt; = Path(&lt;DirEntry&gt;) <span class="hljs-comment"># Path object.</span>
1472+
</code></pre>
1473+
<pre><code class="python language-python hljs">&lt;Path&gt; = Path(&lt;DirEntry&gt;) <span class="hljs-comment"># Path object.</span>
1474+
&lt;file&gt; = open(&lt;DirEntry&gt;) <span class="hljs-comment"># File object.</span>
14721475
</code></pre>
14731476
<div><h3 id="shellcommands">Shell Commands</h3><pre><code class="python language-python hljs"><span class="hljs-keyword">import</span> os
14741477
&lt;str&gt; = os.popen(<span class="hljs-string">'&lt;shell_command&gt;'</span>).read()

0 commit comments

Comments
 (0)