Thanks DeaD_EyE!
You hint of "ip_command = 'ip link show {}'.format(link)" helped
You hint of "ip_command = 'ip link show {}'.format(link)" helped
#!/usr/bin/python import subprocess node = ['node41', 'node42', 'node52'] link = ['eth0', 'eth0', 'eht0'] for i in range(len(node)): ip_command = 'ip link show {}'.format(link[i]) print ip_command subprocess.call(["ssh", node[i], ip_command])