def ssh_login_xxx(host_ip): do the login stuf def ssh_login_yyy(host_ip): do the login stuf def ssh_login_zzz(host_ip): do the login stuf login_functions = {'xxx':ssh_login_xxx, 'yyy':ssh_login_yyy, 'zzz':ssh_login_xxx} with open (input_file, 'r') as my_file: csv_reader = csv.DictReader(my_file) for line in csv_reader: dev_model = line['dev_model'] host_ip = line['host_ip'] try: login_function = login_functions[dev_model] function_name(host_ip) except KeyError: print(f'Unknown device model: {dev_model}')
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs