System-related Information module: Import sys
Sys.Argvis aListthat contains all the command-line arguments.Sys.STDOUT SYS.STDIN SYS.StdErrThe file object that represents the standard input output and the error output, respectively.Sys.Stdin.ReadLine() Read a line from standard inputSys.StdOut.Write ( "a" ) screen output a sys. (exit_code) exit procedure Span class= "PLN" > Sys. is a dictionarymodule< in the system Span class= "PLN" > Sys. get running operating system environment Sys.listmodule ,package
Operating system-related calls and actions: import OS
Os.EnvironOneDictionaryMapping relationships that contain environment variablesOs.Environ["HOME"] Environment variables can be obtainedHOMEThe valueOs.ChDir(Dir) Change the current directoryOs.ChDir(' D:\\outlook ') AttentionWindowsUse to escapeOs.Getcwd() Get current directoryOs.Getegid() Get a valid groupID OS.Getgid() Get GroupID OS.Getuid() Get the userID OS.Geteuid() Get a valid userID OS.Setegid OS.Setegid()Os.Seteuid()Os.Setuid() Os. () get user group Name list OS getlogin () get user login name OS getenv Get environment variable Os. set environment variable Os. set umask os. System (cmd) Use system invoke, run cmd command
OS and sys modules in Python