Jun-07-2021, 04:14 PM
list_of_commands on each loop you currently have as
FIRST_PORT = 0 LAST_PORT = 3 for number in range(FIRST_PORT, (LAST_PORT +1)): list_of_commands = ["interface eth 0/0" + str(number), "shut"] print(list_of_commands)which give the following commands
Output:['interface eth 0/00', 'shut']
['interface eth 0/01', 'shut']
['interface eth 0/02', 'shut']
['interface eth 0/03', 'shut']
In your description you stated E0/0-3, so maybe you want the followingFIRST_PORT = 0 LAST_PORT = 3 for number in range(FIRST_PORT, (LAST_PORT +1)): list_of_commands = [f"interface eth 0/{number}", "shut"] print(list_of_commands)which will give
Output:['interface eth 0/0', 'shut']
['interface eth 0/1', 'shut']
['interface eth 0/2', 'shut']
['interface eth 0/3', 'shut']