Write a python function to create an argument parser that takes inputs as program name and description of program and filename as inputs for variable length of args


Topic: Write a python function to create an argument parser that takes inputs as program name and description of program and filename as inputs for variable length of args

Solution

import argparse
def create_parser(prog_name, prog_description, arg_name):
    parser = argparse.ArgumentParser(prog = prog_name, description = prog_description)
    parser.add_argument(arg_name, nargs='+')
    #args = parser.parse_args()
    return parser



List all Python Programs