diff --git a/README.md b/README.md index 96bb5be..e55e0f2 100644 --- a/README.md +++ b/README.md @@ -1625,20 +1625,20 @@ def write_to_file(filename, text): Paths ----- ```python -import os, os.path as path, glob +import os, glob from pathlib import Path ``` ```python = os.getcwd() # Returns the current working directory. - = path.join(, ...) # Joins two or more pathname components. - = path.realpath() # Resolves symlinks and calls path.abspath(). + = os.path.join(, ...) # Joins two or more pathname components. + = os.path.realpath() # Resolves symlinks and calls path.abspath(). ``` ```python - = path.basename() # Returns final component of the path. - = path.dirname() # Returns path without the final component. - = path.splitext() # Splits on last period of the final component. + = os.path.basename() # Returns final component of the path. + = os.path.dirname() # Returns path without the final component. + = os.path.splitext() # Splits on last period of the final component. ``` ```python @@ -1647,9 +1647,9 @@ from pathlib import Path ``` ```python - = path.exists() # Or: .exists() - = path.isfile() # Or: .is_file() - = path.isdir() # Or: .is_dir() + = os.path.exists() # Or: .exists() + = os.path.isfile() # Or: .is_file() + = os.path.isdir() # Or: .is_dir() ``` ```python diff --git a/index.html b/index.html index c6d711c..79b1899 100644 --- a/index.html +++ b/index.html @@ -1382,24 +1382,24 @@ value = args.<name> file.write(text) -

#Paths

import os, os.path as path, glob
+

#Paths

import os, glob
 from pathlib import Path
 
<str>  = os.getcwd()                # Returns the current working directory.
-<str>  = path.join(<path>, ...)     # Joins two or more pathname components.
-<str>  = path.realpath(<path>)      # Resolves symlinks and calls path.abspath().
+<str>  = os.path.join(<path>, ...)  # Joins two or more pathname components.
+<str>  = os.path.realpath(<path>)   # Resolves symlinks and calls path.abspath().
 
-
<str>  = path.basename(<path>)      # Returns final component of the path.
-<str>  = path.dirname(<path>)       # Returns path without the final component.
-<tup.> = path.splitext(<path>)      # Splits on last period of the final component.
+
<str>  = os.path.basename(<path>)   # Returns final component of the path.
+<str>  = os.path.dirname(<path>)    # Returns path without the final component.
+<tup.> = os.path.splitext(<path>)   # Splits on last period of the final component.
 
<list> = os.listdir(path='.')       # Returns filenames located at the path.
 <list> = glob.glob('<pattern>')     # Returns paths matching the wildcard pattern.
 
-
<bool> = path.exists(<path>)        # Or: <Path>.exists()
-<bool> = path.isfile(<path>)        # Or: <DirEntry/Path>.is_file()
-<bool> = path.isdir(<path>)         # Or: <DirEntry/Path>.is_dir()
+
<bool> = os.path.exists(<path>)     # Or: <Path>.exists()
+<bool> = os.path.isfile(<path>)     # Or: <DirEntry/Path>.is_file()
+<bool> = os.path.isdir(<path>)      # Or: <DirEntry/Path>.is_dir()
 
<stat> = os.stat(<path>)            # Or: <DirEntry/Path>.stat()
 <real> = <stat>.st_mtime/st_size/…  # Modification time, size in bytes, ...