9 filename2
= sys
.argv
[2]
12 file = open(filename
,'r')
13 content1
= file.read()
15 for line
in content1
.split('\n'):
18 item
= line
.split('\t')
19 if not result1
.has_key(item
[0]):
20 result1
.update({item
[0]:{}})
21 if not result1
[item
[0]].has_key(item
[1]):
22 result1
[item
[0]].update({item
[1]:[0]})
23 result1
[item
[0]][item
[1]][0]+=1
24 result1
[item
[0]][item
[1]].append(item
)
27 file = open(filename2
,'r')
28 content2
= file.read()
30 for line
in content2
.split('\n'):
33 item
= line
.split('\t')
34 if not result2
.has_key(item
[0]):
35 result2
.update({item
[0]:{}})
36 if not result2
[item
[0]].has_key(item
[1]):
37 result2
[item
[0]].update({item
[1]:[0]})
38 result2
[item
[0]][item
[1]][0]+=1
39 result2
[item
[0]][item
[1]].append(item
)
43 w
= open('difference.txt','w')
44 w1
= open('differenceDetail.raw.txt','w')
45 w2
= open('differenceDetail.new.txt','w')
46 def writeData(item1
, item2
):
60 for itemkey1
in result1
.keys():
61 for itemkey2
in result1
[itemkey1
].keys():
62 if not result2
[itemkey1
].has_key(itemkey2
):
68 if result1
[itemkey1
][itemkey2
][0] != result2
[itemkey1
][itemkey2
][0]:
73 if result1
[itemkey1
][itemkey2
] < result2
[itemkey1
][itemkey2
]:
78 writeData(result2
[itemkey1
][itemkey2
][1:], result1
[itemkey1
][itemkey2
][1:])