Untitled
unknown
python
2 years ago
797 B
10
Indexable
def usage2(argv): ss_env = '' ss_name = '' assume_yes = '' opts, args = getopt.getopt(argv, "he:s:a", ["environment", "system", "assume-yes"]) for opt, arg in opts: if opt == '-h': usage() elif opt in ("-e", "--environment"): ss_env = arg elif opt in ("-s", "--system"): ss_name = arg elif opt in ("-a", "--assume-yes"): assume_yes = True print('Environment is', ss_env) print('System is', ss_name) print('assume_yes is', assume_yes) ------ When I call it with: python script.py -e dev -s system1 I get: Environment is dev System is system1 assume_yes is But when I call it with: python script --environment dev --system system1 I get: Environment is System is assume_yes is
Editor is loading...