Track 15 · Lesson 6 of 11
Command-line scripts
Turn automation scripts into command-line tools with argparse, a testable main() function and meaningful exit codes.
You will be able to
- Define positional arguments, options with types and defaults, and on/off flags with argparse
- Test an argument parser by passing an explicit list to parse_args
- Validate arguments with choices and custom type functions
- Structure a script around main(argv) that returns an exit code
Included with a Formula Quest membership
It has 4 graded exercises with feedback, hints and solutions. Python Quest is included in Formula Quest memberships that cover Python; membership and billing are managed on Formula Quest.
View Formula Quest memberships
Tracks 1 and 2, the first lesson of every track, the playground and the dataset library are free.