The module provides a convenient way to the operating system
Os.environ: Returns the system environment variable OS.GETENV (ENV): Returns the value of the environment variable env os.getpid (): The process of the current program Os.uname (): Returns a System Information object Os.chdir (PATH) : Change Directory OS.GETCWD (): Current directory Os.listdir (path='. ' ): File Os.mkdir in current directory: Create a directory Os.remove (path): Remove file Os.rmdir (path): Remove directory Os.rename (SRC,DST): Rename file Os.readlink ( Path): Read the real address of the linked file Os.path module: Os.path.abspath (path): Put back the absolute path of the current path Os.path.basename (path): Return file name Os.path.dirname (path) : Return directory name Os.path.exist (path): Interpret whether the file or directory exists Os.path.isdir: Determine if the path is a directory Os.path.isfile (path): Determine if the path is a file Os.path.join ( Dirname,basename): Connect directory Name and file name Os.path.split (path): Detach directory Name and file name Os.path.splitext (path): Detach file name (this file name does not contain a suffix) and file suffix
Summary of common methods for Python OS modules