@ -1445,21 +1445,22 @@ value = args.<name>
< / code > < / pre >
< div > < h2 id = "commandexecution" > < a href = "#commandexecution" name = "commandexecution" > #< / a > Command Execution< / h2 > < div > < h3 id = "filesanddirectories" > Files and Directories< / h3 > < ul >
< li > < strong > Paths can be either strings, Paths, or DirEntry objects.< / strong > < / li >
< li > < strong > All exceptions are either ' OSError' or its subclasses.< / strong > < / li >
< / ul > < pre > < code class = "python language-python hljs" > < span class = "hljs-keyword" > import< / span > os
< li > < strong > All exceptions are either OSError or its subclasses.< / strong > < / li >
< / ul > < pre > < code class = "python language-python hljs" > < span class = "hljs-keyword" > import< / span > os, shutil
< str> = os.getcwd() < span class = "hljs-comment" > # Returns the current working directory.< / span >
os.chdir(< path> ) < span class = "hljs-comment" > # Changes current working directory.< / span >
< / code > < / pre > < / div > < / div >
< pre > < code class = "python language-python hljs" > shutil.copy(from, to) < span class = "hljs-comment" > # Copies the file.< / span >
os.rename(from, to) < span class = "hljs-comment" > # Renames the file or directory.< / span >
os.replace(from, to) < span class = "hljs-comment" > # Same, but overwrites 'to' if it exists.< / span >
< / code > < / pre >
< pre > < code class = "python language-python hljs" > os.remove(< path> ) < span class = "hljs-comment" > # Deletes the file.< / span >
os.rmdir(< path> ) < span class = "hljs-comment" > # Deletes empty directory.< / span >
shutil.rmtree(< path> ) < span class = "hljs-comment" > # Deletes the entire directory tree.< / span >
< / code > < / pre >
< pre > < code class = "python language-python hljs" > os.rename(from, to) < span class = "hljs-comment" > # Renames the file or directory.< / span >
os.replace(from, to) < span class = "hljs-comment" > # Same, but overwrites 'to' if it exists.< / span >
< / code > < / pre >
< pre > < code class = "python language-python hljs" > os.mkdir(< path> , mode=< span class = "hljs-number" > 0o777< / span > ) < span class = "hljs-comment" > # Creates a directory.< / span >
< iter> = os.scandir(path=< span class = "hljs-string" > '.'< / span > ) < span class = "hljs-comment" > # Returns os.DirEntry objects located at path.< / span >
< / code > < / pre >