I've a Python script and run it from command line with possible arguments. After some arguments should add value.
For example:
[ab:c]
I am using getopt.getopt() Python function to get arguments and values. I know if after an argument is colon means need to add value to the related argument. In this case: 'b'
How can I handle if user add arg. '-b' but missed to add value for -b but add the 3rd oprtion to command:
python3 mypythoncmd -a -b -c
If I am using getopt.getopt() function result is:
[('-a',''),('-b','-c')]
...but this wrong because '-c' is an another argument.
Is possible to handle it somehow? Missing value from arg throw and error?
Thanks