|
|
@ -1394,7 +1394,7 @@ value = args.<name> |
|
|
|
<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> |
|
|
|
<str> = <DirEntry>.path <span class="hljs-comment"># Returns whole path as a string.</span> |
|
|
|
<str> = <DirEntry>.name <span class="hljs-comment"># Returns final component as a string.</span> |
|
|
|
<file> = open(<DirEntry>) <span class="hljs-comment"># Opens the file and returns file object.</span> |
|
|
|
<file> = open(<DirEntry>) <span class="hljs-comment"># Opens the file and returns a file object.</span> |
|
|
|
</code></pre> |
|
|
|
<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 |
|
|
|
</code></pre></div> |
|
|
@ -1417,7 +1417,7 @@ value = args.<name> |
|
|
|
<iter> = <Path>.glob(<span class="hljs-string">'<pattern>'</span>) <span class="hljs-comment"># Returns Paths matching the wildcard pattern.</span> |
|
|
|
</code></pre> |
|
|
|
<pre><code class="python language-python hljs"><str> = str(<Path>) <span class="hljs-comment"># Returns path as a string.</span> |
|
|
|
<file> = open(<Path>) <span class="hljs-comment"># Opens the file and returns file object.</span> |
|
|
|
<file> = open(<Path>) <span class="hljs-comment"># Opens the file and returns a file object.</span> |
|
|
|
</code></pre> |
|
|
|
<div><h2 id="oscommands"><a href="#oscommands" name="oscommands">#</a>OS Commands</h2><div><h3 id="filesanddirectories">Files and Directories</h3><ul> |
|
|
|
<li><strong>Paths can be either strings, Paths or DirEntry objects.</strong></li> |
|
|
|