try:
    opts, args = getopt.getopt(sys.argv[1:], 'm:p:h', ['miner=', 'params=',
        'help'])
except getopt.GetoptError:
    usage()
sys.exit(2)
for opt, arg in opts:
    pass
How to use getopt/OPTARG in Python? How to shift arguments if too many arguments (9) are given?