Processing command-line arguments in prefix notation in Python
- by ejm
I'm trying to parse a command-line in Python which looks like the following:
$ ./command -o option1 arg1 -o option2 arg2 arg3
In other words, the command takes an unlimited number of arguments, and each argument may optionally be preceded with an -o option, which relates specifically to that argument. I think this is called a "prefix notation".
…