--python实现两个文件并集,排序,计数
--(1)python版本2.3以上,低版本的python不支持set(),本文采用的是python2.7。
import sys
import time
time_start=time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))
print time_start
num=0
s1 = set(open('/home/work/ctt/20150409.uid','r').readlines())
for i in range(0,10):
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