The individual doesn't quite understand
OS operation file directory. SYS interacts with the system environment. That's probably it.
Run other programs using the Os.system function
The system () function in the OS module makes it easy to run other programs or scripts. Its function prototype is shown below.
Os.system (command)
The meaning of its parameters is as follows.
command to execute, equivalent to the command entered in the Windows CMD window. If you want to pass parameters to a program or script, you can use a space-delimited program and multiple parameters.
Os Common methods
Os.remove () deleting files
Os.rename () Renaming files
Os.walk () Generate all file names under the directory tree
Os.chdir () Change Directory
Os.mkdir/makedirs Creating a directory/multi-level directory
Os.rmdir/removedirs Deleting a directory/multi-level directory
Os.listdir () lists files for the specified directory
OS.GETCWD () Get the current working directory
Os.chmod () Changing directory permissions
Os.path.basename () Remove directory path, return file name
Os.path.dirname () Remove file name, return directory path
Os.path.join () combines parts of the separation into one path name
Os.path.split () return (DirName (), basename ()) tuple
Os.path.splitext () return (filename, extension) tuple
Os.path.getatime\ctime\mtime returns the last access, creation, modification time, respectively
Os.path.getsize () returns the file size
Os.path.exists () is present
Os.path.isabs () is an absolute path
Os.path.isdir () is a directory
Os.path.isfile () is a file
SYS Common Methods
SYS.ARGV command line argument list, the first element is the path of the program itself
Sys.modules.keys () returns the list of all modules that have been imported
Sys.exc_info () Gets the exception class currently being processed, Exc_type, Exc_value, exc_traceback the exception details currently handled
Sys.exit (n) exit program, Exit normally (0)
Sys.hexversion gets the version value of the Python interpreter, 16 binary format such as: 0x020403f0
Sys.version get version information for Python interpreter
Sys.maxint the largest int value
Sys.maxunicode the largest Unicode value
Sys.modules returns the module field of the system import, key is the module name, value is the module
Sys.path returns the search path for the module, using the value of the PYTHONPATH environment variable when initializing
Sys.platform returns the operating system platform name
Sys.stdout Standard Output
Sys.stdin Standard input
Sys.stderr Error Output
Sys.exc_clear () to clear current or recent error messages that are present on the current thread
Sys.exec_prefix returns the location of the platform standalone Python file installation
Sys.byteorder The local byte rule indicator, the value of the Big-endian platform is ' big ', the value of the Little-endian platform is ' little '
Sys.copyright record python copyright-related things
API version of C for the Sys.api_version interpreter
Summarize:
The OS module is responsible for the interaction between the program and the operating system, provides access to the underlying interface of the operating system, and the SYS module is responsible for the interaction between the program and the Python interpreter, providing a series of functions and variables for manipulating the Python runtime environment.
Python-os, sys