<pre><codeclass="python language-python hljs"><list> = listdir(<spanclass="hljs-string">'<path>'</span>) <spanclass="hljs-comment"># List of filenames located at 'path'.</span>
<pre><codeclass="python language-python hljs"><list> = listdir(<spanclass="hljs-string">'<path>'</span>) <spanclass="hljs-comment"># List of filenames located at path.</span>
<list> = glob(<spanclass="hljs-string">'<pattern>'</span>) <spanclass="hljs-comment"># Filenames matching the wildcard pattern.</span>
<list> = glob(<spanclass="hljs-string">'<pattern>'</span>) <spanclass="hljs-comment"># Filenames matching the wildcard pattern.</span>
<Path> = <Path>.parent <spanclass="hljs-comment"># Returns path without final component.</span>
</code></pre>
</code></pre>
<div><h2id="commandexecution"><ahref="#commandexecution"name="commandexecution">#</a>Command Execution</h2><div><h3id="filesanddirectories">Files and Directories</h3><ul>
<div><h2id="commandexecution"><ahref="#commandexecution"name="commandexecution">#</a>Command Execution</h2><div><h3id="filesanddirectories">Files and Directories</h3><ul>
<li><strong>Paths can be either strings or Path objects.</strong></li>
<li><strong>Paths can be either strings or Path objects.</strong></li>
<li><strong>All exceptions are either 'OSError' or its subclasses.</strong></li>
<li><strong>All exceptions are either 'OSError' or its subclasses.</strong></li>
</ul><pre><codeclass="python language-python hljs"><spanclass="hljs-keyword">import</span> os
</ul><pre><codeclass="python language-python hljs"><spanclass="hljs-keyword">import</span> os
<str> = os.getcwd() <spanclass="hljs-comment"># Returns the current working directory.</span>
<str> = os.getcwd() <spanclass="hljs-comment"># Returns the current working directory.</span>
os.chdir(<path>) <spanclass="hljs-comment"># Changes the current working directory.</span>
os.chdir(<path>) <spanclass="hljs-comment"># Changes current working directory.</span>
xxxxxxxxxx