私はどのようにargparse.ArgumentParser機能するかを学ぼうとしましたが、そのためにいくつかの行を書きました:
global firstProduct
global secondProduct
myparser=argparse.ArgumentParser(description='parser test')
myparser.add_argument("product1",help="enter product1",dest='product_1')
myparser.add_argument("product2",help="enter product2",dest='product_2')
args=myparser.parse_args()
firstProduct=args.product_1
secondProduct=args.product_2
firstProductユーザーが2つのパラメーターを使用してこのスクリプトを実行すると、コードがそれぞれに割り当てられますsecondProduct。しかし、うまくいきません。理由を教えてくれる人はいますか?前もって感謝します