\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{mad100141} \pdfinfo{ /Title (path-cheat-sheet-python.pdf) /Creator (Cheatography) /Author (mad100141) /Subject (Path - Python Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{A33367} \definecolor{LightBackground}{HTML}{F9F2F5} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Path - Python Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{mad100141} via \textcolor{DarkBackground}{\uline{cheatography.com/121760/cs/38305/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}mad100141 \\ \uline{cheatography.com/mad100141} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 19th April, 2023.\\ Updated 20th April, 2023.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Directory Commands}} \tn % Row 0 \SetRowColor{LightBackground} `dirname()` & parent, os.path.dirname() \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} classmethod `getcwd()` & Return the current working directory as a path object. `os.getcwd()` \tn % Row Count 6 (+ 4) % Row 2 \SetRowColor{LightBackground} `dirs({\emph{args, }}*kwargs)` & {\emph{List of this directory's subdirectories.}} The elements of the list are Path objects. This does not walk recursively into subdirectories (but see walkdirs()). Accepts parameters to listdir(). \tn % Row Count 16 (+ 10) % Row 3 \SetRowColor{white} `exists()` & {\emph{os.path.exists() Return True if path refers to an existing path or an open file descriptor.}} Returns False for broken symbolic links or missing permissions \tn % Row Count 24 (+ 8) % Row 4 \SetRowColor{LightBackground} property {\bf{drive}} & The drive specifier, for example 'C:'. \tn % Row Count 26 (+ 2) % Row 5 \SetRowColor{white} `expand()` & Clean up a filename by calling expandvars(), expanduser(), and normpath() on it. \tn % Row Count 30 (+ 4) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Directory Commands (cont)}} \tn % Row 6 \SetRowColor{LightBackground} expanduser() & Return the argument with an initial component of \textasciitilde{} or \textasciitilde{}user replaced by that user's home directory. \tn % Row Count 6 (+ 6) % Row 7 \SetRowColor{white} expandvars() & Return the argument with environment variables expanded. Substrings of the form \$name or \$\{name\} are replaced by the value of environment variable name. Bad variables are left unchanged. \tn % Row Count 16 (+ 10) % Row 8 \SetRowColor{LightBackground} property {\bf{ext}} & The file extension, for example '.py'. \tn % Row Count 18 (+ 2) % Row 9 \SetRowColor{white} `files({\emph{args, }}*kwargs)` & List of the files in self. The elements of the list are Path objects. This does not walk into subdirectories (see walkfiles()). Accepts parameters to listdir(). \tn % Row Count 27 (+ 9) % Row 10 \SetRowColor{LightBackground} `fnmatch(pattern, normcase=None)` & Return True if self.name matches the given pattern. {\bf{pattern}} - A filename pattern with wildcards, for example '*.py'. {\bf{normcase}} - (optional) A function used to normalize the pattern and filename before matching. \tn % Row Count 38 (+ 11) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Directory Commands (cont)}} \tn % Row 11 \SetRowColor{LightBackground} `glob(pattern)` & Return a list of Path objects that match the pattern. {\bf{pattern}} - a path relative to this directory, with wildcards. For example, Path('/users').glob('{\emph{/bin/}}') returns a list of all the files users have in their bin directories. \tn % Row Count 12 (+ 12) % Row 12 \SetRowColor{white} get\_owner() & Return the name of the owner of this file or directory. Follow symbolic links. \tn % Row Count 16 (+ 4) % Row 13 \SetRowColor{LightBackground} getatime() & Return the time of last access of path. \tn % Row Count 18 (+ 2) % Row 14 \SetRowColor{white} getctime() & Return the system's ctime which, on some systems (like Unix) is the time of the last metadata change \tn % Row Count 24 (+ 6) % Row 15 \SetRowColor{LightBackground} getsize() & Return the size, in bytes, of path. \tn % Row Count 26 (+ 2) % Row 16 \SetRowColor{white} getmtime() & Return the time of last modification of path. \tn % Row Count 29 (+ 3) % Row 17 \SetRowColor{LightBackground} iglob(pattern) & Return an iterator of Path objects that match the pattern. pattern - a path relative to this directory, with wildcards. \tn % Row Count 35 (+ 6) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Directory Commands (cont)}} \tn % Row 18 \SetRowColor{LightBackground} {\bf{in\_place(mode='r', buffering=-1, encoding=None, errors=None, newline=None, backup\_extension=None)}} & A context in which a file may be re-written in-place with new content. Yields a tuple of (readable, writable) file objects, where writable replaces readable. A ValueError is raised on invalid modes. \tn % Row Count 10 (+ 10) % Row 19 \SetRowColor{white} isabs() & Return True if path is an absolute pathname. On Unix, that means it begins with a slash \tn % Row Count 15 (+ 5) % Row 20 \SetRowColor{LightBackground} `isdir()` & Return True if path is an existing directory \tn % Row Count 18 (+ 3) % Row 21 \SetRowColor{white} isfile() & Return True if path is an existing regular file. \tn % Row Count 21 (+ 3) % Row 22 \SetRowColor{LightBackground} islink() & Return True if path refers to an existing directory entry that is a symbolic link. \tn % Row Count 26 (+ 5) % Row 23 \SetRowColor{white} ismount() & Return True if pathname path is a mount point: a point in a file system where a different file system has been mounted \tn % Row Count 32 (+ 6) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Creation Commands}} \tn % Row 0 \SetRowColor{LightBackground} `walk(match=None, errors='strict')` & {\bf{Iterator over files and subdirs, recursively.}} The iterator yields Path objects naming each child item of this directory and its descendants. \tn % Row Count 8 (+ 8) % Row 1 \SetRowColor{white} \seqsplit{symlink(newlink=None)} & Create a symbolic link at newlink, pointing here. default = cwd \tn % Row Count 12 (+ 4) % Row 2 \SetRowColor{LightBackground} text(encoding=None, errors='strict') & Legacy function to read text. Converts all newline sequences to \textbackslash{}n. \tn % Row Count 16 (+ 4) % Row 3 \SetRowColor{white} touch() & Set the access/modified times of this file to the current time. Create the file if it does not exist. \tn % Row Count 22 (+ 6) % Row 4 \SetRowColor{LightBackground} unlink() & Remove (delete) the file path. `os.remove()` \tn % Row Count 25 (+ 3) % Row 5 \SetRowColor{white} unlink\_p() & Like remove(), but does not raise an exception if the file does not exist. \tn % Row Count 29 (+ 4) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{2}{x{17.67cm}}{classmethod using\_module(module)} \tn % Row Count 30 (+ 1) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Creation Commands (cont)}} \tn % Row 7 \SetRowColor{LightBackground} utime({\emph{args, }}*kwargs) & Set the access and modified times of this file. \tn % Row Count 3 (+ 3) % Row 8 \SetRowColor{white} walkdirs(*args, **kwargs) & Iterator over subdirs, recursively. \tn % Row Count 5 (+ 2) % Row 9 \SetRowColor{LightBackground} walkfiles(*args, **kwargs) & Iterator over files, recursively. \tn % Row Count 7 (+ 2) % Row 10 \SetRowColor{white} with\_suffix(suffix) & Return a new path with the file suffix changed (or added, if none) \tn % Row Count 11 (+ 4) % Row 11 \SetRowColor{LightBackground} write\_bytes(bytes, append=False) & Open this file and write the given bytes to it. \tn % Row Count 14 (+ 3) % Row 12 \SetRowColor{white} write\_lines(lines, encoding=None, errors='strict', \seqsplit{linesep=\_default\_linesep}, append=False) & Write the given lines of text to this file. \tn % Row Count 19 (+ 5) % Row 13 \SetRowColor{LightBackground} write\_text(text, encoding=None, errors='strict', linesep=os.linesep, append=False) & Write the given text to this file. \tn % Row Count 24 (+ 5) % Row 14 \SetRowColor{white} class path.TempDir({\emph{args, }}*kwargs) & A temporary directory via tempfile.mkdtemp(), and constructed with the same parameters that you can use as a context manager. \tn % Row Count 31 (+ 7) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Directory Manipulation Commmands}} \tn % Row 0 \SetRowColor{LightBackground} joinpath(*others) & Join one or more path segments intelligently. The return value is the concatenation of path and all members of *paths, with exactly one directory separator following each non-empty part, except the last. That is, the result will only end in a separator if the last part is either empty or ends in a separator. \tn % Row Count 16 (+ 16) % Row 1 \SetRowColor{white} lines(encoding=None, errors=None, retain=True) & Open this file, read all lines, return them in a list. \tn % Row Count 19 (+ 3) % Row 2 \SetRowColor{LightBackground} link(newpath) & Create a hard link at newpath, pointing to this file. \tn % Row Count 22 (+ 3) % Row 3 \SetRowColor{white} listdir(match=None) & List of items in this directory. \tn % Row Count 24 (+ 2) % Row 4 \SetRowColor{LightBackground} lstat() & Like stat(), but do not follow symbolic links. \tn % Row Count 27 (+ 3) % Row 5 \SetRowColor{white} \seqsplit{makedirs(mode=0o777)} & Recursive directory creation function. Like mkdir(), but makes all intermediate-level directories needed to contain the leaf directory. \tn % Row Count 34 (+ 7) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Directory Manipulation Commmands (cont)}} \tn % Row 6 \SetRowColor{LightBackground} \seqsplit{makedirs\_p(mode=0o777)} & Like makedirs(), but does not raise an exception if the directory already exists. \tn % Row Count 5 (+ 5) % Row 7 \SetRowColor{white} merge\_tree(dst, symlinks=False, *, \seqsplit{copy\_function=shutil}.copy2, ignore=lambda dir, contents: ...) & Copy entire contents of self to dst, overwriting existing contents in dst with those in self. Pass symlinks=True to copy symbolic links as links. Accepts a copy\_function, similar to copytree. \tn % Row Count 15 (+ 10) % Row 8 \SetRowColor{LightBackground} mkdir(mode=0o777) & Create a directory named path with numeric mode mode. \tn % Row Count 18 (+ 3) % Row 9 \SetRowColor{white} mkdir\_p(mode=0o777) & Like mkdir(), but does not raise an exception if the directory already exists. \tn % Row Count 22 (+ 4) % Row 10 \SetRowColor{LightBackground} module = \textless{}module 'posixpath' (frozen)\textgreater{} & The path module to use for path operations. \tn % Row Count 25 (+ 3) % Row 11 \SetRowColor{white} move(dst, \seqsplit{copy\_function=copy2)} & Recursively move a file or directory to another location. This is similar to the Unix "mv" command. Return the file or directory's destination. \tn % Row Count 33 (+ 8) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Directory Manipulation Commmands (cont)}} \tn % Row 12 \SetRowColor{LightBackground} property {\bf{mtime}} & Last modified time of the file. \tn % Row Count 2 (+ 2) % Row 13 \SetRowColor{white} property {\bf{name}} & The name of this file or directory without the full path. `basename()` \tn % Row Count 6 (+ 4) % Row 14 \SetRowColor{LightBackground} normcase() & Normalize the case of a pathname. \tn % Row Count 8 (+ 2) % Row 15 \SetRowColor{white} normpath() & Normalize a pathname by collapsing redundant separators and up-level references so that A//B, A/B/, A/./B and A/foo/../B all become A/B. This string manipulation may change the meaning of a path that contains \tn % Row Count 19 (+ 11) % Row 16 \SetRowColor{LightBackground} open({\emph{args, }}*kwargs) & Open this file and return a corresponding file object. \tn % Row Count 22 (+ 3) % Row 17 \SetRowColor{white} property {\bf{owner}} & Name of the owner of this file or directory. \tn % Row Count 25 (+ 3) % Row 18 \SetRowColor{LightBackground} property {\bf{parent}} & This path's parent directory, as a new Path object. \tn % Row Count 28 (+ 3) % Row 19 \SetRowColor{white} parts() & \seqsplit{Path('/foo/bar/baz')}.parts() -\textgreater{} (Path('/'), 'foo', 'bar', 'baz') \tn % Row Count 32 (+ 4) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Directory Manipulation Commmands (cont)}} \tn % Row 20 \SetRowColor{LightBackground} pathconf(name) & Return system configuration information relevant to a named file \tn % Row Count 4 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{class path.Path - represents filesystem path}} \tn % Row 0 \SetRowColor{LightBackground} abspath() & Return a normalized absolutized version of the pathname path. \seqsplit{`normpath(join(os.getcwd()}, path))` \tn % Row Count 5 (+ 5) % Row 1 \SetRowColor{white} access(*args, **kwargs) & Return does the real user have access to this path. `os.access()` \tn % Row Count 9 (+ 4) % Row 2 \SetRowColor{LightBackground} basename() & Return the base name of pathname path. This is the second element of the pair returned by passing path to the function split(). \tn % Row Count 16 (+ 7) % Row 3 \SetRowColor{white} bytes() & Open this file, read all bytes, return them as a string. \tn % Row Count 19 (+ 3) % Row 4 \SetRowColor{LightBackground} cd() & `os.chdir(path)` Change the current working directory to path. \tn % Row Count 23 (+ 4) % Row 5 \SetRowColor{white} chdir() & `os.chdir(path)` \tn % Row Count 24 (+ 1) % Row 6 \SetRowColor{LightBackground} chown(uid=-1, gid=-1) & Change the owner and group by names or numbers. \tn % Row Count 27 (+ 3) % Row 7 \SetRowColor{white} chroot() & Change the root directory of the current process to path. \tn % Row Count 30 (+ 3) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{class path.Path - represents filesystem path (cont)}} \tn % Row 8 \SetRowColor{LightBackground} chunks(size, {\emph{args, }}*kwargs) & Returns a generator yielding chunks of the file, so it can be read piece by piece with a simple for loop. Any argument you pass after size will be passed to open(). \tn % Row Count 9 (+ 9) % Row 9 \SetRowColor{white} copy(dst, *, \seqsplit{follow\_symlinks=True)} & Copy data and mode bits ("cp src dst"). Return the file's destination. The destination may be a directory. \tn % Row Count 15 (+ 6) % Row 10 \SetRowColor{LightBackground} copy2(dst, *, \seqsplit{follow\_symlinks=True)} & Copy data and metadata. Return the file's destination. Metadata is copied with copystat(). Please see the copystat function for more information. \tn % Row Count 23 (+ 8) % Row 11 \SetRowColor{white} copyfile(dst, *, \seqsplit{follow\_symlinks=True)} & Copy data from src to dst in the most efficient way possible. \tn % Row Count 27 (+ 4) % Row 12 \SetRowColor{LightBackground} copymode(dst, *, \seqsplit{follow\_symlinks=True)} & Copy mode bits from src to dst. \tn % Row Count 29 (+ 2) % Row 13 \SetRowColor{white} copystat(dst, *, \seqsplit{follow\_symlinks=True)} & Copy file metadata. Copy the permission bits, last access time, last modification time, and flags from src to dst. \tn % Row Count 35 (+ 6) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{class path.Path - represents filesystem path (cont)}} \tn % Row 14 \SetRowColor{LightBackground} copytree(dst, symlinks=False, ignore=None, \seqsplit{copy\_function=copy2}, \seqsplit{ignore\_dangling\_symlinks=False}, \seqsplit{dirs\_exist\_ok=False)} & Recursively copy a directory tree and return the destination directory. If exception(s) occur, an Error is raised with a list of reasons. \tn % Row Count 7 (+ 7) % Row 15 \SetRowColor{white} property ctime & Creation time of the file. \tn % Row Count 9 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Remove Change Commmands}} \tn % Row 0 \SetRowColor{LightBackground} remove() & Remove (delete) the file path. Raises Error if Directory or FileNotFound. \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} remove\_p() & Like remove(), but does not raise an exception if the file does not exist. \tn % Row Count 8 (+ 4) % Row 2 \SetRowColor{LightBackground} removedirs() & Remove directories recursively. \tn % Row Count 10 (+ 2) % Row 3 \SetRowColor{white} removedirs\_p() & Like removedirs(), but does not raise an exception if the directory is not empty or does not exist. \tn % Row Count 15 (+ 5) % Row 4 \SetRowColor{LightBackground} rename(new) & Rename the file or directory src to dst. \tn % Row Count 17 (+ 2) % Row 5 \SetRowColor{white} renames(new) & Recursive directory or file renaming function. Works like rename(), except creation of any intermediate directories needed to make the new pathname good is attempted first. \tn % Row Count 26 (+ 9) % Row 6 \SetRowColor{LightBackground} rmdir() & os.rmdir() \tn % Row Count 27 (+ 1) % Row 7 \SetRowColor{white} rmdir\_p() & Like rmdir(), but does not raise an exception if the directory is not empty or does not exist. \tn % Row Count 32 (+ 5) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Remove Change Commmands (cont)}} \tn % Row 8 \SetRowColor{LightBackground} \seqsplit{rmtree(ignore\_errors=False}, onerror=None, *, dir\_fd=None) & Recursively delete a directory tree. \tn % Row Count 3 (+ 3) % Row 9 \SetRowColor{white} rmtree\_p() & Like rmtree(), but does not raise an exception if the directory does not exist. \tn % Row Count 7 (+ 4) % Row 10 \SetRowColor{LightBackground} samefile(other) & Return True if both pathname arguments refer to the same file or directory. \tn % Row Count 11 (+ 4) % Row 11 \SetRowColor{white} property {\bf{size}} & Size of the file, in bytes. \tn % Row Count 13 (+ 2) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{2}{x{17.67cm}}{special = functools.partial(\textless{}class 'path.SpecialResolver'\textgreater{}, \textless{}class 'path.Path'\textgreater{})} \tn % Row Count 15 (+ 2) % Row 13 \SetRowColor{white} splitall() & Return a list of the path components in this path. \tn % Row Count 18 (+ 3) % Row 14 \SetRowColor{LightBackground} splitdrive() & Return two-tuple of .drive and rest without drive. \tn % Row Count 21 (+ 3) % Row 15 \SetRowColor{white} splitext() & Return two-tuple of .stripext() and .ext. \tn % Row Count 24 (+ 3) % Row 16 \SetRowColor{LightBackground} splitpath() & Return two-tuple of .parent, .name. \tn % Row Count 26 (+ 2) % Row 17 \SetRowColor{white} stat() & Perform a stat() system call on this path. \tn % Row Count 29 (+ 3) % Row 18 \SetRowColor{LightBackground} statvfs() & Perform a statvfs() system call on this path. f\_bsize, f\_frsize, f\_blocks, f\_bfree, f\_bavail, f\_files, f\_ffree, f\_favail, f\_flag, f\_namemax, f\_fsid. \tn % Row Count 37 (+ 8) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Remove Change Commmands (cont)}} \tn % Row 19 \SetRowColor{LightBackground} property stem & The same as name(), but with one file extension stripped off. \tn % Row Count 4 (+ 4) % Row 20 \SetRowColor{white} stripext() & Remove one file extension from the path. \tn % Row Count 6 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.2896 cm} x{8.9804 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Read Commands}} \tn % Row 0 \SetRowColor{LightBackground} read\_bytes() & Return the contents of this file as bytes. \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \seqsplit{read\_hash(hash\_name)} & Calculate given hash for this file. \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} \seqsplit{read\_hexhash(hash\_name)} & Calculate given hash for this file, returning hexdigest. \tn % Row Count 8 (+ 3) % Row 3 \SetRowColor{white} read\_md5() & Calculate the md5 hash for this file. \tn % Row Count 10 (+ 2) % Row 4 \SetRowColor{LightBackground} \seqsplit{read\_text(encoding=None}, errors=None) & Open this file, read it in, return the content as a string. Optional parameters are passed to open(). \tn % Row Count 16 (+ 6) % Row 5 \SetRowColor{white} readlink() & Return the path to which this symbolic link points. The result may be an absolute or a relative path. \tn % Row Count 22 (+ 6) % Row 6 \SetRowColor{LightBackground} readlinkabs() & Return the path to which this symbolic link points. \tn % Row Count 25 (+ 3) % Row 7 \SetRowColor{white} realpath() & \seqsplit{`os.path.realpath()`} \tn % Row Count 26 (+ 1) % Row 8 \SetRowColor{LightBackground} relpath(start='.') & Return this path as a relative path, based from start, which defaults to the current working directory. \tn % Row Count 32 (+ 6) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.2896 cm} x{8.9804 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Read Commands (cont)}} \tn % Row 9 \SetRowColor{LightBackground} relpathto(dest) & Return a relative path from self to dest. \tn % Row Count 3 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \end{document}