Im trying to write a script using python language(abc.py). I need to take few command line arguments while executing the script.
say -m, -p are my arguments. I need to have a string beside these options. ex:
1. $> python abc.py -m 'first' -p 'second' {correct}
2. $> python abc.py -p 'first' -m 'second' {correct}
3. $> python abc.py -m -p 'first' 'second' {Incorrect}
4. $> python abc.py 'first' -p 'second' {Incorrect}
I have more such arguments like -m, -p. What is the best algorithm to check if the passed arguments are in the correct format. I am unable think other than the method maintaining the previous argument and check based on it.
Thanks for you help in advance
Anji