Is it possible to check argparse choices in case-insensitive manner?
import argparse choices = [\"win64\", \"win32\"] parser = argparse.ArgumentParser() pars
Transform the argument into lowercase by using
type = str.lower
for the -p switch.
-p
This solution was pointed out by chepner in a comment. The solution I proposed earlier was
type = lambda s : s.lower()
which is also valid, but it's simpler to just use str.lower.
str.lower