Skip to content

Commit f42965d

Browse files
committed
Path
1 parent d1e8a83 commit f42965d

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,15 +1577,15 @@ from glob import glob
15771577
```
15781578

15791579
```python
1580-
<str> = getcwd() # Returns the current working directory.
1580+
<str> = getcwd() # Returns current working directory.
15811581
<str> = path.join(<path>, ...) # Joins two or more pathname components.
1582-
<str> = path.abspath(<path>) # Returns an absolute path.
1582+
<str> = path.abspath(<path>) # Returns absolute path.
15831583
```
15841584

15851585
```python
1586-
<str> = path.basename(<path>) # Returns final component.
1587-
<str> = path.dirname(<path>) # Returns path without final component.
1588-
<tup.> = path.splitext(<path>) # Splits on last period of final component.
1586+
<str> = path.basename(<path>) # Returns final component of the path.
1587+
<str> = path.dirname(<path>) # Returns path without the final component.
1588+
<tup.> = path.splitext(<path>) # Splits on last period of the final component.
15891589
```
15901590

15911591
```python
@@ -1610,7 +1610,7 @@ from os import scandir
16101610
<iter> = scandir(path='.') # Returns DirEntry objects located at path.
16111611
<str> = <DirEntry>.path # Returns path as a string.
16121612
<str> = <DirEntry>.name # Returns final component as a string.
1613-
<file> = open(<DirEntry>) # Opens the file and returns a file object.
1613+
<file> = open(<DirEntry>) # Opens the file and returns file object.
16141614
```
16151615

16161616
### Path Object
@@ -1644,7 +1644,7 @@ from pathlib import Path
16441644

16451645
```python
16461646
<str> = str(<Path>) # Returns path as a string.
1647-
<file> = open(<Path>) # Opens the file and returns a file object.
1647+
<file> = open(<Path>) # Opens the file and returns file object.
16481648
```
16491649

16501650

@@ -1659,7 +1659,7 @@ import os, shutil
16591659
```
16601660

16611661
```python
1662-
os.chdir(<path>) # Changes the current working directory.
1662+
os.chdir(<path>) # Changes current working directory.
16631663
os.mkdir(<path>, mode=0o777) # Creates a directory. Mode is in octal.
16641664
```
16651665

index.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,13 +1457,13 @@
14571457
<span class="hljs-keyword">from</span> glob <span class="hljs-keyword">import</span> glob
14581458
</code></pre></div>
14591459

1460-
<pre><code class="python language-python hljs">&lt;str&gt; = getcwd() <span class="hljs-comment"># Returns the current working directory.</span>
1460+
<pre><code class="python language-python hljs">&lt;str&gt; = getcwd() <span class="hljs-comment"># Returns current working directory.</span>
14611461
&lt;str&gt; = path.join(&lt;path&gt;, ...) <span class="hljs-comment"># Joins two or more pathname components.</span>
1462-
&lt;str&gt; = path.abspath(&lt;path&gt;) <span class="hljs-comment"># Returns an absolute path.</span>
1462+
&lt;str&gt; = path.abspath(&lt;path&gt;) <span class="hljs-comment"># Returns absolute path.</span>
14631463
</code></pre>
1464-
<pre><code class="python language-python hljs">&lt;str&gt; = path.basename(&lt;path&gt;) <span class="hljs-comment"># Returns final component.</span>
1465-
&lt;str&gt; = path.dirname(&lt;path&gt;) <span class="hljs-comment"># Returns path without final component.</span>
1466-
&lt;tup.&gt; = path.splitext(&lt;path&gt;) <span class="hljs-comment"># Splits on last period of final component.</span>
1464+
<pre><code class="python language-python hljs">&lt;str&gt; = path.basename(&lt;path&gt;) <span class="hljs-comment"># Returns final component of the path.</span>
1465+
&lt;str&gt; = path.dirname(&lt;path&gt;) <span class="hljs-comment"># Returns path without the final component.</span>
1466+
&lt;tup.&gt; = path.splitext(&lt;path&gt;) <span class="hljs-comment"># Splits on last period of the final component.</span>
14671467
</code></pre>
14681468
<pre><code class="python language-python hljs">&lt;list&gt; = listdir(path=<span class="hljs-string">'.'</span>) <span class="hljs-comment"># Returns filenames located at path.</span>
14691469
&lt;list&gt; = glob(<span class="hljs-string">'&lt;pattern&gt;'</span>) <span class="hljs-comment"># Returns paths matching the wildcard pattern.</span>
@@ -1479,7 +1479,7 @@
14791479
<pre><code class="python language-python hljs">&lt;iter&gt; = scandir(path=<span class="hljs-string">'.'</span>) <span class="hljs-comment"># Returns DirEntry objects located at path.</span>
14801480
&lt;str&gt; = &lt;DirEntry&gt;.path <span class="hljs-comment"># Returns path as a string.</span>
14811481
&lt;str&gt; = &lt;DirEntry&gt;.name <span class="hljs-comment"># Returns final component as a string.</span>
1482-
&lt;file&gt; = open(&lt;DirEntry&gt;) <span class="hljs-comment"># Opens the file and returns a file object.</span>
1482+
&lt;file&gt; = open(&lt;DirEntry&gt;) <span class="hljs-comment"># Opens the file and returns file object.</span>
14831483
</code></pre>
14841484
<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
14851485
</code></pre></div>
@@ -1501,7 +1501,7 @@
15011501
&lt;iter&gt; = &lt;Path&gt;.glob(<span class="hljs-string">'&lt;pattern&gt;'</span>) <span class="hljs-comment"># Returns Paths matching the wildcard pattern.</span>
15021502
</code></pre>
15031503
<pre><code class="python language-python hljs">&lt;str&gt; = str(&lt;Path&gt;) <span class="hljs-comment"># Returns path as a string.</span>
1504-
&lt;file&gt; = open(&lt;Path&gt;) <span class="hljs-comment"># Opens the file and returns a file object.</span>
1504+
&lt;file&gt; = open(&lt;Path&gt;) <span class="hljs-comment"># Opens the file and returns file object.</span>
15051505
</code></pre>
15061506
<div><h2 id="oscommands"><a href="#oscommands" name="oscommands">#</a>OS Commands</h2><div><h3 id="filesanddirectories">Files and Directories</h3><ul>
15071507
<li><strong>Paths can be either strings, Paths, or DirEntry objects.</strong></li>
@@ -1511,7 +1511,7 @@
15111511

15121512

15131513

1514-
<pre><code class="python language-python hljs">os.chdir(&lt;path&gt;) <span class="hljs-comment"># Changes the current working directory.</span>
1514+
<pre><code class="python language-python hljs">os.chdir(&lt;path&gt;) <span class="hljs-comment"># Changes current working directory.</span>
15151515
os.mkdir(&lt;path&gt;, mode=<span class="hljs-number">0o777</span>) <span class="hljs-comment"># Creates a directory. Mode is in octal.</span>
15161516
</code></pre>
15171517
<pre><code class="python language-python hljs">shutil.copy(from, to) <span class="hljs-comment"># Copies the file.</span>

0 commit comments

Comments
 (0)