Last active
October 13, 2021 02:58
-
-
Save liamkeegan/ed97d86a4fc668de60a60103abb3a695 to your computer and use it in GitHub Desktop.
List of Lists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a list of lists called configs. Each element of configs is its own list. | |
configs = [ | |
['rtr1','10.1.1.1','cisco','cisco'], | |
['rtr2','10.1.1.2','cisco','cisco'], | |
['rtr3','10.1.1.3','cisco','cisco'] | |
] | |
# Iterate through the configs list. For each individual list, we then reference it as 'config'. Use an f-string notation to print it in the string. | |
for config in configs: | |
print(f'This hostname is {config[0]}, the IP address is {config[1]} and the passwords are {config[2]}/{config[3]}') | |
# To add to the list | |
configs.append(['rtr3','10.1.1.3','cisco','cisco']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment