[Solved] Python – var = var = var value


Use a dictionary, not variables. If you have variable names, the way to get the variable contents is evil, and almost always there is a better way. In this case:

server_connection_commands = {
  "AdminServer": "putty.exe -ssh 1.1.1.1",
  "Server1": "putty.exe -ssh 2.2.2.2"
}
server = requests.get('http://example.com').text
subprocess.Popen(server_connection_commands[server])

2

solved Python – var = var = var value