标签:\n print font odi replace online state set port
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import glob
import operator
import os
if __name__ == "__main__":
work_dir=‘/sys/class/fc_host/host*/port_state‘
for item in glob.glob(work_dir):
f = open(item)
for line in f:
if line == ‘Online\n‘:
wwn_item = item.replace("state", "name")
fn = open(wwn_item)
for wwn in fn:
print wwn,
fn.close()
f.close()
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
if __name__ == "__main__":
f = open("112wwn")
wwn_set=set()
for line in f:
wwn_set.add(line)
f.close()
print(wwn_set.__len__())
f_host = open("172wwn")
for wwn in f_host:
if wwn in wwn_set:
print(‘True‘)
else:
print(‘False‘)
f_host.close()
标签:\n print font odi replace online state set port
原文地址:https://www.cnblogs.com/donggongdechen/p/9805341.html