#--os modules that operate on the operating system
System () Executes the systems command in Python
Stat () Get file information
Listdir () Gets a list of the names of all the contents in the specified folder
GETCWD () Gets the path where the current file is located
ChDir () Modify the path of the current file work
Getenv () Gets the current PATH environment variable information
Putenv () temporarily Add environment variable
#--os.environ OS Environment module
os.environ[' PATH '] writes environment variables into the system
#--os Module Properties
Name get system ID linux,mac->posix windows->nt
Sep get path split symbol Linux,mac/window-> \
Linesep get system line break symbol Linux, \ n window->\r\n or \ n
=======================================================================================
#--os modules that operate on the operating system
Import OS
# systems () Execute system commands in Python
Os.system (' mkdir lianxi001 ')
Os.system (' Rm-rf lianxi001 ')
# stat () Get file information
res = Os.stat ("1.py")
Print (RES)
# Listdir () Gets a list of the names of all the contents in the specified folder
res = Os.listdir ('. ')
Print (RES) # Returns a table of contents
# GETCWD () Gets the path where the current file is located
res = OS.GETCWD ()
Print (res) #/mnt/hgfs/vm_gongxiang/day15
# chdir () modify the path of the current file work
Os.chdir ('/home/wangwen/ceshi0801 ')
Os.system ("mkdir cesih002")
# getenv () Gets the current PATH environment variable information
res = os.getenv ("PATH")
Os.system ("Wangwen")
Print (RES)
# putenv () temporarily Add environment variable
res = os.putenv ("PATH", "/home/wangwen/ceshi0801/")
Os.system ("Wangwen")
#--os.environ OS Environment module
# os.environ[' PATH ' #把环境变量写进系统中
# Print (Os.environ)
os.environ[' PATH '] + = ":/home/wangwen/ceshi0801/"
Os.system ("star")
Print (os.environ[' PATH ')
# name gets the system ID linux,mac->posix windows->nt
Print (Os.name)
# Sep Get path split symbol Linux,mac/window-> \
Print (OS.SEP)
# Linesep Gets the line break symbol for the system Linux, \ n window->\r\n or \ n
Print (Repr (OS.LINESEP))
Python_ Object-oriented _os system command module