You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
shutil.rmtree(<path>) <spanclass="hljs-comment"># Deletes an entire directory tree.</span>
1440
1440
</code></pre>
1441
-
<pre><codeclass="python language-python hljs">os.rename(<spanclass="hljs-keyword">from</span>, to) <spanclass="hljs-comment"># Renames the file or directory.</span>
1442
-
os.replace(<spanclass="hljs-keyword">from</span>, to) <spanclass="hljs-comment"># Same, but overwrites 'to' if it exists.</span>
1441
+
<pre><codeclass="python language-python hljs">os.rename(<spanclass="hljs-keyword">from</span>, to) <spanclass="hljs-comment"># Renames the file or directory.</span>
1442
+
os.replace(<spanclass="hljs-keyword">from</span>, to) <spanclass="hljs-comment"># Same, but overwrites 'to' if it exists.</span>
1443
1443
</code></pre>
1444
-
<pre><codeclass="python language-python hljs">os.mkdir(<path>, mode=<spanclass="hljs-number">0o777</span>) <spanclass="hljs-comment"># Creates a directory.</span>
1445
-
<iter> = os.scandir(path=<spanclass="hljs-string">'.'</span>) <spanclass="hljs-comment"># Returns os.DirEntry objects located at path.</span>
1444
+
<pre><codeclass="python language-python hljs">os.mkdir(<path>, mode=<spanclass="hljs-number">0o777</span>) <spanclass="hljs-comment"># Creates a directory.</span>
1445
+
<iter> = os.scandir(path=<spanclass="hljs-string">'.'</span>) <spanclass="hljs-comment"># Returns os.DirEntry objects located at path.</span>
1446
1446
</code></pre>
1447
1447
<h4id="direntry">DirEntry:</h4>
1448
-
<pre><codeclass="python language-python hljs"><str> = <DirEntry>.name <spanclass="hljs-comment"># Final component of the path.</span>
1449
-
<str> = <DirEntry>.path <spanclass="hljs-comment"># Path with final component.</span>
1450
-
<bool> = <DirEntry>.is_file()
1448
+
<pre><codeclass="python language-python hljs"><str> = <DirEntry>.name <spanclass="hljs-comment"># Final component of the path.</span>
1449
+
<str> = <DirEntry>.path <spanclass="hljs-comment"># Path with final component.</span>
<pre><codeclass="python language-python hljs"><spanclass="hljs-keyword">from</span> time <spanclass="hljs-keyword">import</span> time
1985
-
start_time = time() <spanclass="hljs-comment"># Seconds since Epoch.</span>
1986
+
start_time = time() <spanclass="hljs-comment"># Seconds since Epoch.</span>
1986
1987
...
1987
1988
duration = time() - start_time
1988
1989
</code></pre>
1989
1990
<h3id="highperformance">High Performance</h3>
1990
1991
<pre><codeclass="python language-python hljs"><spanclass="hljs-keyword">from</span> time <spanclass="hljs-keyword">import</span> perf_counter <spanclass="hljs-keyword">as</span> pc
1991
-
start_time = pc() <spanclass="hljs-comment"># Seconds since restart.</span>
1992
+
start_time = pc() <spanclass="hljs-comment"># Seconds since restart.</span>
0 commit comments