Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [Host1]
- dfwm2
- dwm1-su2
- [Host2]
- cisb1
- cisb2
- [Othe]
- b4
- b8
- [1]
- edit
- run show
- exit
- show et-0/0/0 brief
- show adjacency
- show oamtest
- edit
- run
- def read_hosts(filename):
- # Read the filename and store file content in a variable as list of lines. Variable - file_cont
- hosts={}
- key=''
- value=[]
- with open(filename) as f:
- lines = f.read().splitlines()
- for line in lines:
- #if '[' in line and ']' in line:
- if line.startswith('[') and line.endswith(']'):
- key = line[1:-1]
- value = []
- hosts[key]=value
- return hosts
Add Comment
Please, Sign In to add comment