getopt- parse command line arguments

getopt module for parsing the command line parameters sys. Unix support of getopt () function function, and provides a function

getopt(args,options[,long_options])

 

Parse command line arguments, to get rid of the beginning of the running program references. It is usually assigned to the args sys.argv [1:]. options parameter with a string of letters, each letter represents an option, after the option comprising adding a subsequent value colon.
long_options, the format string is a list of option names need not be included in the preamble "-." Long options need to be accompanied "=" after the parameter, then with a value. If you only want to accept long options, the options can be set to an empty string. Long option as long as possible to identify,
Return Value two elements: a (option, value) list, the remaining unresolved parameters. Each (option, value) to return, comprising preamble option name "-" or "-" option argument as the second parameter, or an empty string. The order they appear in the list returned in the order of occurrence in the same command line. Length of mixing options.
More technical information may concern: gzicast

Guess you like

Origin www.cnblogs.com/heimaguangzhou/p/11670725.html