<file> = open(<Path>) # Opens the file and returns a file object.
```
### DirEntry
**Using scandir() instead of listdir() or iterdir() can significantly increase the performance of code that also needs file type or file attribute information.**
```python
<iter> = os.scandir(path='.') # Returns DirEntry objects located at path.
```
```python
<bool> = <DirEntry>.is_file()
<bool> = <DirEntry>.is_dir()
```
```python
<str> = <DirEntry>.path # Returns relative path as a string.
<str> = <DirEntry>.name # Returns final component.
<str> = path.dirname(<path>) <spanclass="hljs-comment"># Returns path without final component.</span>
<tup.> = path.splitext(<path>) <spanclass="hljs-comment"># Splits on last period of final component.</span>
</code></pre>
<pre><codeclass="python language-python hljs"><list> = listdir(<path>) <spanclass="hljs-comment"># Returns filenames located at path.</span>
<pre><codeclass="python language-python hljs"><list> = listdir(path=<spanclass="hljs-string">'.'</span>)<spanclass="hljs-comment"># Returns filenames located at path.</span>
<list> = glob(<spanclass="hljs-string">'<pattern>'</span>) <spanclass="hljs-comment"># Returns paths matching the wildcard pattern.</span>
<div><h3id="direntry">DirEntry</h3><p><strong>Using scandir() instead of listdir() can significantly increase the performance of code that also needs file type information.</strong></p><pre><codeclass="python language-python hljs"><iter> = scandir(path=<spanclass="hljs-string">'.'</span>) <spanclass="hljs-comment"># Returns DirEntry objects located at path.</span>
</code></pre></div>
<pre><codeclass="python language-python hljs"><str> = <DirEntry>.path <spanclass="hljs-comment"># Returns path as a string.</span>
<str> = <DirEntry>.name <spanclass="hljs-comment"># Returns final component as a string.</span>
<file> = open(<DirEntry>) <spanclass="hljs-comment"># Opens the file and returns a file object.</span>
<pre><codeclass="python language-python hljs"><str> = str(<Path>) <spanclass="hljs-comment"># Returns Path as a string.</span>
<file> = open(<Path>) <spanclass="hljs-comment"># Opens the file and returns a file object.</span>
</code></pre>
<div><h3id="direntry">DirEntry</h3><p><strong>Using scandir() instead of listdir() or iterdir() can significantly increase the performance of code that also needs file type or file attribute information.</strong></p><pre><codeclass="python language-python hljs"><iter> = os.scandir(path=<spanclass="hljs-string">'.'</span>) <spanclass="hljs-comment"># Returns DirEntry objects located at path.</span>