I am trying to parse arguments passed from command line.I am passing 15 arguments at all. I am trying to group those by giving them same destination () I need to group those. Now when I print input i get lists f.e [mylogo.png, otherlogo.png] and so on. How I could get a result similar to {destination:'value1','value2'} . I know I could do it manually but It's not a solution in my case..
parser = argparse.ArgumentParser(prog='Moodle automation', add_help= False,
description=description(), usage='nana nanan nana')
parser.add_argument('-logo', '--set_logo',
help='',
dest='branding',
type=str,
action='append')
parser.add_argument('-c_logo', '--set_compact_logo',
help='',
dest='branding',
type=str,
action='append'
)
web_status.add_argument('-wn', '--web_new',
help=" ",
dest='web_state',
action="append")
web_status.add_argument('-wo', '--web_old',
help="",
dest="web_state",
action="append")
args = parser.parse_args()
branding_details = args.branding
print(branding_details)
in case input:
program.py -logo mylogo.png -c_logo custom_logo.png
I get output ['mylogo.png', 'custom_logo.png']