OS module: Operating system interface
You should use the Import OS style instead of the From OS import *. This ensures that Os.open (), which varies with the operating system, does not overwrite the built-in function open () is useful for using the Dir () and help () functions built into large modules such as the OS.
For daily file and directory management tasks, the Shutil module provides an easy-to-use, high-level interface.
Glob module: Generate a list of files from the directory wildcard search
1 Import Glob,os 2 os.chdir ('Desktop')3 glob.glob ('*.desktop ')4 ans: ['xxx.desktop']
Command-line arguments: command-line arguments are stored as a list of argv variables in the SYS module.
1 Import SYS 2 Print sys.argv
SYS also has the Stdin,stdout,stderr property, which can be used to display warnings and error messages even when STDOUT is redirected.
Sys.stderr.write (' warning .... ')
Most scripts are directed to terminate using Sys.exit ()
Re module: string matching
For a simple operation, the string method is best used:
' Tea for too '. Replace ('too','both ')
Smtplib module: Sending an email
URLLIB2 module: Access to the Internet
DateTime module: Date and time processing
REPR module: Provides a customized version of the REPR () function for large or deep nested container abbreviation displays
Pprint module: Provides an interpreter-readable way to deeply control the printing of built-in and user-defined objects.
TextWrap module: Modules format text paragraphs to fit a set screen width
Locale module:
Template module:
Python QuickStart (5)