Good day everyone! And please tell me how in python, or in general, replace the following:
if sys.argv[1] == "restart_ca": client = JsonClient(str(sys.argv[2]), 8081) client.connect() ... elif sys.argv[1] == "stop_ca": client = JsonClient(str(sys.argv[2]), 8081) client.connect() ... elif sys.argv[1] == "start_ca": client = JsonClient(str(sys.argv[2]), 8081) client.connect() ... elif sys.argv[1] == 'set_reg_key_net_int': client = JsonClient(str(sys.argv[2]), 8081) client.connect() ... sys.argv [1] is the passed method through the argument
And there are a lot of such checks in the program (Is there a way to simplify such a scenario? Tell me please.