Python: Building Command-Line Tools with argparse

Wishlist Share

About Course

Turn a Python script into a proper command-line tool with argparse, part of the standard library. Learn positional and optional arguments, types, defaults, choices and flags, automatic help, error handling, mutually exclusive options and subcommands, with a complete worked example.

Tutwoo is an independent learning provider. This course is written from the official documentation listed in the sources, which can change, so always check the current documentation for the version you use. It is not endorsed by any of the organisations listed and is not an accredited qualification.

© 2026 Tutwoo UK Limited. This course was created in-house by Tutwoo and is our original work. It is for your own learning only: please do not copy, share, record or resell it.

What Will You Learn?

  • Create an ArgumentParser with a useful description and help
  • Add positional arguments, options and on/off flags
  • Use type, default, choices and nargs to validate input
  • Build mutually exclusive options and subcommands

Course Content

Course Lessons

  • Your first parser
  • Positional arguments, options and flags
  • Validating input: choices, nargs and errors
  • Groups, subcommands and a complete example

Sources & Further Reading
The official guidance this course is based on.

Final Assessment

Student Ratings & Reviews

No Review Yet
No Review Yet

Want to receive push notifications for all major on-site activities?

✕