有人可以帮助我吗,我是编程初学者,我的问题是输出我只想过滤mac地址。我该怎么做。
from netmiko import ConnectHandler
cisco = {
'device_type' : 'cisco_ios',
'host' : '192.168.X.Y',
'username' : 'foo',
'password' : '123',
}
net_connect = ConnectHandler(**cisco)
net_connect.find_prompt()
show_mac = net_connect.send_command("show mac address-table vlan 100")
print(show_mac)
输出 :
Vlan Mac Address Type Ports
---- ----------- -------- -----
100 264b.edf4.eba2 DYNAMIC Gi0/3
100 2680.f1ee.c0b1 DYNAMIC Gi0/2
100 3a60.2954.1ee2 DYNAMIC Gi1/3
100 4a60.05bd.27fc DYNAMIC Gi1/2
100 7e02.eee8.0291 DYNAMIC Gi0/1
100 b689.d44e.afd1 DYNAMIC Gi1/0
100 d207.6258.5966 DYNAMIC Gi1/1
Total Mac Addresses for this criterion: 7