ArgumentParser

class

argparse.ArgumentParser(prog=None, usage=None, description=None, epilog=None, parents=[], formatter_class=argparse.HelpFormatter, prefix_chars='-', fromfile_prefix_chars=None, argument_default=None, conflict_handler='error', add_help=True, allow_abbrev=True)

  1. prog - name of the program (default: sys.argv [0])
  2. usage - use a string describing the program (default: generating a parameter added to the parser)
  3. description - text to be displayed before the parameter help file (Default: None)
  4. epilog - text displayed after the parameter help file (Default: None)
  5. parents - ArgumentParser a list of objects, their parameters should also be included
  6. formatter_class - help documentation for customizing the output format of the class
  7. prefix_chars - prefix characters optional set of parameters (default: '-')
  8. fromfile_prefix_chars - when other parameters need to be read from a file, a prefix character set (default: None) containing the filename
  9. argument_default - global default value of the parameter (default: None)
  10. conflict_handler - Strategies to resolve conflicts option (usually unnecessary)
  11. add_help - Adding a -h / parser - help option (default: True)
  12. allow_abbrev - If the abbreviation is unambiguous, allows abbreviations long options (default: True)
     
发布了888 篇原创文章 · 获赞 93 · 访问量 18万+

Guess you like

Origin blog.csdn.net/weixin_36670529/article/details/104033625