统计文件中去重后的uuid个数 2014/11/19 14575 import re pattern=re.compile(r'&uuid=.*&') uuidset=set() with open('request.log.2015-05-26','rt') as f: for line in f: all=pattern.findall(line) if len(all)>0 and line.find('iphone')>0: # print(all[0]) uuidset.add(all[0]) print(len(uuidset))