Argparse Tutorial Release 3.9.5 Guido van Rossum and the Python development team June 01, 2021 Python Software Foundation Email: docs@python.org 1 Concepts 2 2 The basics 2 3 Introducing Positional arguments 3 4 Introducing Optional arguments 5 4.1 Short options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 5 Combining Positional and Optional arguments 6 6 Getting a little more advanced 10 6.1 Conflicting options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 7 Conclusion 12 Contents author Tshepang Lekhonkhobe This tutorial is intended to be a gentle introduction to$_{argparse}$, the recommended command-line parsing module in the Python standard library. Note: There are two other modules that fulfill the same task, namely$_{getopt}$(an equivalent for$_{getopt()}$ from the C language) and the deprecated$_{optparse}$. Note also that$_{argparse}$is based on$_{optparse}$, and therefore very similar in terms of usage. 1