Python in OS and sys modules

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.