Import OS
Print (OS.GETCWD ()) # Fetch the current working directory, absolute Path
Os.chdir ("..") # Change the current directory
Print (Os.curdir) # current directory, relative path
Print (Os.pardir) # Parent directory, relative path
Os.mkdir ("Test1") # Create a folder or write an absolute path, default to the current directory
Os.rmdir ("Test1") # Delete the specified folder, only the empty folder
Os.remove ("Test") # Delete file, cannot delete folder
Print (Os.listdir ('. ')) # list all files in one directory
Print (Os.listdir (R ' d:\\ '))
Os.rename ("Test", "Test1") # renamed, followed by new name
Print (Os.stat ("F1")) # get file information
Print (__file__) # is the absolute path to this file, the delimiter is incorrect under windows
Print (Os.path.abspath (__file__)) # get absolute path
Print (Os.path.split ("/usr/hehe/hehe.txt")) # split path and file name
Print (Os.path.dirname ("/usr/local")) # Get Parent Directory
Print (Os.path.basename ("/usr/local")) # Gets the last level, if the file display filename, if the directory is displayed directory name
Print (Os.path.exists ("/usr/local")) # Directory/file exists
Print (Os.path.isfile ("F1")) # To determine if it is a file
Print (Os.path.isdir ("/usr/local")) # is a folder
Print (Os.path.join ("root", ' hehe ', ' a.sql ')) # stitching into a path
# print (OS.SEP) # Path delimiter for the current operating system
#
# print (OS.LINESEP) # line break for the current operating system
#
# print (OS.PATHSEP) # The delimiter for each path in the environment variables of the current system, Linux is:, Windows is;
#
# print (Os.environ) # Environment variables for the current system
#
# print (os.name) # current system name
Os.system (' calc ') # used to execute operating system commands, can only execute, get no results
res = Os.popen (' ipconfig ') # used to execute operating system commands, and get to return results
Print (Res.read ())
# import Sys
# print (Sys.path) # Environment variables
# print (sys.platform) # See what the current operating system is
# print (sys.version) # See Python version
# print (SYS.ARGV) # Gets the parameters passed in when the Python file is run
# quit () # Quit Program
# Print (Sys.exit (' Exit Program ')) # Exit program, Exit normally (0)
python--Common Modules