About getopt


#1
import getopt
import sys

argv = sys.argv[1:]
try:
 opts, args = getopt.getopt(argv, 'hm:d', ['help', 'my_file='])
 print(opts)
 print(args)
except getopt.GetoptError:
 #Print a message or do something useful
 print('Something went wrong!')
 sys.exit(2)

in the above code ```
opts, args = getopt.getopt(argv, ‘hm:d’, [‘help’, ‘my_file=’])
whats difference between hm:d and h:m:d.In some codes they use like hlp:m and some separated by colons.when to use like that


#2

Not my area of expertise, but here is some documentation…

getopt – Command line option parsing

Hopefully someone will pipe in with an answer to your question.