KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have an optional argument that supports a list of arguments itself. I mean, it should support: -f 1 2 -f 1 2 3 but not: -f 1 -f 1 2 3 4 Is there a way to force this within argparse ? Now I'm using nargs="*", and then checking the list length. Edit: As requested, what I needed is being able to define a range of acceptable number of arguments. I mean, saying (in the example) 2 or 3 args is right, but not 1 or 4 or anything that's not inside the range 2..3
Tags (comma-separated)
Save Edits
Cancel