Sys. argv command line parameter List. The first element is the program path sys. modules. keys () returns the list of all imported modules sys. exc_info () obtains the exception classes currently being processed, including exc_type, exc_value, and exc_traceback. exit (n) exit the program. exit (0) sys when the program Exits normally. hexversion gets the version value of the Python interpreter. The hexadecimal format is 0x020403F0 sys. obtain the version information of the Python interpreter sys. the maximum Int value of maxint sys. the maximum Unicode value of maxunicode is sys. modules returns the module field imported by the system. The key is the module name and the value is the module sys. path: return the search path of the module. during initialization, use the value of the PYTHONPATH environment variable sys. platform returns the name of the operating system platform sys. stdout standard output sys. stdin standard input sys. stderr error output sys. exc_clear () is used to clear the current or nearest error information generated by the current frontend. sys.exe c_prefix: the location where the python file on the platform is installed is sys. byteorder refers to the indicator of the local byte rule. The value of the big-endian platform is 'Big ', and the value of the little-endian Platform Is 'Little 'sys. copyright records python copyright related things sys. API version sys of C of api_version interpreter. version_info sys. version_info (2, 4, 3, 'final', 0) 'final' indicates the final state, and 'canonicaldate' indicates the candidate state, indicating the version level and whether there is a subsequent release sys. displayhook (value) if the value is not empty, this function will output it to sys. stdout, and save it into _ builtin __. _. in the python interactive interpreter, '_' indicates the result you entered last time. hook indicates the hook and hooks the result to sys. getdefaultencoding () returns the current default character encoding format sys. getfilesystemencoding () returns the encoded name sys that converts the Unicode file name to the system file name. setdefaultencoding (name) is used to set the current default character encoding. If the name and any available encoding do not match, LookupError is thrown. This function will only be used by sitecustomize of the site module, once the site module is used, it will remove sys from the sys module. list of modules imported by builtin_module_names Python interpreter sys.exe cutable Python interpreter path sys. getwindowsversion () gets the Windows version sys. stdin. readline () reads a row from the standard input, sys. stdout. write ("a") screen output a sys. startswith () is used to determine the beginning of an object. For example, input 'abc' In the python command line '. startswith ('AB') "will return True. Problem: implement command line read parameter Read File" python readfile. py c:/test.txt d:/test.txt "" python readfile. py -- help ", then sys. argv [0] indicates "test. py "[python] import sys def readfile (filename): ''' Print a file to the standard output. '''f = file (filename) while True: line = f. readline () if len (line) = 0: break print line, f. close () # Script starts from here if len (sys. argv) <2: print 'no action specified. 'sys. exit () if sys. argv [1]. startswith ('--'): option = sys. argv [1] [2:] # fetch sys. argv [1] but without the first two characters if option = 'version': print 'version 1.0 'elif option = 'help ': print ''' This program prints files to the standard output. any number of files can be specified. options include: -- version: Prints the version number -- help: Display this help -- file: file '''else: www.2cto.com print 'unknown option. 'sys. exit () else: for filename in sys. argv [1:]: readfile (filename) refer to this example to modify sendemail. py -- to xx -- content xx -- topic xx -- attach xx