Answers for "run function from argument parser"

0

run function from argument parser

FUNCTION_MAP = {'top20' : my_top20_func,
                'listapps' : my_listapps_func }

parser.add_argument('command', choices=FUNCTION_MAP.keys())

args = parser.parse_args()

func = FUNCTION_MAP[args.command]
func()
Posted by: Guest on June-01-2020

Code answers related to "run function from argument parser"

Browse Popular Code Answers by Language