Python getopt parameter handles small examples

  • 2020-04-02 09:19:30
  • OfStack

Opts, args = getopt getopt (sys. Argv [1], "t: s: h," [" walletype = ", "servicename =", 'the help'])
For a, o opts in:
If a in ('-t', '--walletype'):
Walle_type = o
Elif a in ('-s', '--servicename'):
The service_name = o
Elif a in ('-h', '--help'):
Help = True

Where t:s:h is the abbreviation of the parameter, and: is the value to be passed after the parameter

Walletype =,servicename=,help means the full name of the parameter, = means the value to be passed later

Related articles: