Skip to content

Instantly share code, notes, and snippets.

@liamkeegan
Last active October 13, 2021 02:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liamkeegan/ed97d86a4fc668de60a60103abb3a695 to your computer and use it in GitHub Desktop.
Save liamkeegan/ed97d86a4fc668de60a60103abb3a695 to your computer and use it in GitHub Desktop.
List of Lists
# 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