0

I have 3 different functions that I want to call based upon the argument from the command line. I can't think of a simple way to make '-c' call function 1, '-o' call function 2, and '-p' call function 3.

Should I store the value using action? I only want one function to be called, which is why I believe the action argument to add_argument() will not work.

Programmer
  • 293
  • 4
  • 15
  • I guess I found a potential solution. I was using poor searches before I guess. My apologies. http://stackoverflow.com/questions/27529610/call-function-based-on-argparse – Programmer Jul 17 '15 at 20:31
  • If they're separate things, why not use a subcommand? – jonrsharpe Jul 17 '15 at 20:31
  • I guess there are several ways to do this. No solution seems simpler than directly using sys.argv instead of ArgumentParser() though. – Programmer Jul 17 '15 at 20:34

0 Answers0