Disable abbreviation in argparse

前端 未结 4 2073
不思量自难忘°
不思量自难忘° 2020-12-18 22:39

argparse uses per default abbreviation in unambiguous cases.

I don\'t want abbreviation and I\'d like to disable it. But didn\'t find it in the documentation.

<
4条回答
  •  温柔的废话
    2020-12-18 23:16

    As of Python 3.5.0 you can disable abbreviations by initiating the ArgumentParser with the following:

    parser = argparse.ArgumentParser(allow_abbrev=False)
    

    Also see the documentation.

提交回复
热议问题