import argparse parser = argparse.ArgumentParser() parser.add_argument("-a", action="store_true", help="get anna's age") parser.add_argument("-b", action="store_true", help="get bob's age") parser.add_argument("-c", action="store_true", help="get carol's age") parser.add_argument("-d", action="store_true", help="get daniel's age") args = parser.parse_args() if args.a: print "17" elif args.b: print "14" elif args.c: print "51" elif args.d: print "8" elif len(sys.argv)==1: parser.print_help() parser.exit()Hi, if i do python test.py -a, it will print "17".
if i do python test.py -b, it will print "14".
Now what i want is that with : python test.py -a -text,
it would output "17" followed by a text i will choose, like:
Output:17 is anna's age
or something like that,
what is the easiest way of doing this?