The argsContain(flag) function in the script only checks if the first argument contains 'flag'. Replace argsContain with:
def argsContain(flag):
""" Flag is the letter/word/etc that follows the '-' or '--' in the options """
# search for flag in options part of args i.e. before filename
found = False
for arg in sys.argv[1:len(sys.argv)-1]:
if arg.find(flag) != -1:
found = True
return found
This checks all the flags for the one you want.
1 comment:
Interesting one. Keep posting such kind of information on your blog. I bookmarked it for continuous visit. Thanks once again.
Post a Comment