hey all
I am trying to write a pogram with arguments and options
I want to call it this way:
python myScript.py -c -f 'C:/Temp/my_file.txt'
OR
python myScript.py -u -f 'C:/Temp/my_file.txt'
where [-f filename] is mandatory
and exactly one of -c or -u should be there
In other words,
Arguments = [-c -u] -f filename (I prefer to drop the -f if possible)
The script copies the file in a destination folder, which is different according to the -c or -u option.
I couldn't write this down.
I used the getOpt module, then the optParse one. I did the [-c -u] part with getopt, but I couldn't add the filename part and validate whether the argument is there..
Please I need some help on this.
I assume it is very easy for those who are familiar with python, but I searched a lot and the documentation about this is very poor, especially when I want to use an option without argument..
Thanks