import re from netmiko import ConnectHandlerips = [ '10.32.5.130', '10.32.5.131', '10.32.5.132', '10.32.5.133', '10.32.5.134', '10.32.5.135', ]for ip in ips:hw_fw = {'device_type': 'huawei','host': ip, 'username': '493031','password': '密码','port': '22' }net_connect = ConnectHandler(**hw_fw)str_data = net_connect.send_command_timing('\rdisplay version\r')print(ip,str_data)print('==================================================')