Python: Case In-sensitive argparse “choices”

Konstantinos Patronas
2 min readAug 20, 2020
Photo by David Clode on Unsplash

There are cases that we need to limit the options that a user will provide as command line arguments, to do this the easy way in python we can use the argparse module which provides a nice way to validate / handle options.

More often i needed to limit the choices of a command line option, to do this i used something like the following:

parser =…

--

--