Argparse: Required argument 'y' if 'x' is present
问题 I have a requirement as follows: ./xyifier --prox --lport lport --rport rport for the argument prox , I use action='store_true' to check if it is present or not. I do not require any of the arguments. But, if --prox is set I require rport and lport as well. Is there an easy way of doing this with argparse without writing custom conditional coding. More Code: non_int.add_argument('--prox', action='store_true', help='Flag to turn on proxy') non_int.add_argument('--lport', type=int, help='Listen