--python實現兩個文件並集,排序,計數python
--(1)python版本2.3以上,低版本的python不支持set(),本文采用的是python2.7。python2.7
import sysui
import time排序
time_start=time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))it
print time_startio
num=0import
s1 = set(open('/home/work/ctt/20150409.uid','r').readlines())nio
for i in range(0,10):im
print i文件
str="/home/work/ctt/data/0409logbefore/00000%s_0"%(i)
print str
s2=set(open(str,'r').readlines())
s3=s1.union(s2)
s1=s3
for item in s3:
num=num+1
# print item
print num
time_end=time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))
print time_end