Location:Home > Turbo catalogue > Audi turbos > python 例外与异常mac地址

python 例外与异常mac地址

Time:2017-09-22 21:36Turbochargers information Click:

Python 异常 地址 例外

[root@pc0003 MySQL-python-1.2.5]# yum install MySQL-python #!/usr/bin/python#coding=utf-8'''依赖MySQLdb python库依赖host="192.168.****.***",user="****",passwd="****",db="****"依赖glpi.switch1119表'''import osimport MySQLdbos.mkdir(r'tmp')filedir='./tmp/6.exception.mac-wlan.onboard.mac.error.list.csv' MacFile=open(filedir,'w')MacFile.write("exception.mac/nMAC地址,用户,设备型号,批准来源/n") print("正在联络数据库")conn=MySQLdb.connect(host="192.168.****.****",user="****",passwd="****",db="****")cur=conn.cursor()select=cur.execute("use ****;") print("正在获取wlan与glpi不匹配的 exception.mac")select=cur.execute("select mac from switch1119 where UPPER(switch1119.mac) not in(select upper(glpi_items_devicenetworkcards.mac) from glpi_items_devicenetworkcards,glpi_devicenetworkcards where glpi_items_devicenetworkcards.devicenetworkcards_id = glpi_devicenetworkcards.id);")info = cur.fetchmany(select)for i in info: MacFile.write(str(i)[2:-3]+",unknow/n") print("正在获取glpi里Ethernet-Onboard的MAC 存在于 wlan中的MAC")MacFile.write("/n/nonboard.mac?/nMAC地址,用户,设备型号,批准来源/n")select=cur.execute("select mac from switch1119 where UPPER(switch1119.mac) in (select upper(glpi_items_devicenetworkcards.mac) from glpi_items_devicenetworkcards,glpi_devicenetworkcards where glpi_items_devicenetworkcards.devicenetworkcards_id = glpi_devicenetworkcards.id and glpi_devicenetworkcards.designation='Ethernet-Onboard');")info = cur.fetchmany(select)for i in info: MacFile.write(str(i)[2:-3]+",unknow/n")cur.close()conn.commit()conn.close()MacFile.close()print('文件保存路径:'+filedir) [root@pc0003 glpi_switch_ocs]# cat ./tmp/6.exception.mac-wlan.onboard.mac.error.list.csvexception.macMAC地址,用户,设备型号,批准来源20:7C:8F:76:****,unknow34:DE:1A:1B:****,unknow onboard.mac?MAC地址,用户,设备型号,批准来源C8:F7:33:15:****,unknowC8:F7:33:18:****,unknow

 

Copyright infringement? Click Here!

Related reading
Related recommend