0

I am trying to make conditional argument parsing. The condition is as follows :

  1. First argument is required and here user has two options to enter for instance "random" and "collection". User can enter random or collection as first argument.

-> IF AND ONLY IF user passes "random" as first argument then user must pass two more arguments as "tag1" and "tag2"

-> IF AND ONLY IF user passes "collection" as first argument then user must pass only one more argument which is "collection_id"

Here we can see that the second argument(s) are depending on the first one. Can anyone please guide me that how can I do that?

  • Check out subparsers: https://docs.python.org/3/library/argparse.html#sub-commands – rdas Apr 07 '21 at 05:50
  • @rdas its not working bro. Though I have applied some checks using if else. Job is done but not as I though it would. – user9113784 Apr 08 '21 at 06:43

0 Answers0