-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.py
More file actions
30 lines (22 loc) · 689 Bytes
/
main.py
File metadata and controls
30 lines (22 loc) · 689 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import json
import heapq
file1 = 'file1.json'
file2 = 'file2.json'
with open(file1,encoding="utf8") as jsonFile:
jsonObject = json.load(jsonFile)
jsonFile.close()
Dict = {}
counts = dict()
for i in jsonObject['metamask']['permissionsHistory']:
counts[i] = counts.get(i, 0) + 1
with open('file2.json',encoding="utf8") as jsonFile:
jsonObject = json.load(jsonFile)
jsonFile.close()
for i in jsonObject['metamask']['permissionsHistory']:
counts[i] = counts.get(i, 0) + 1
result = {k: v for k, v in counts.items() if v>=2}
s = json.dumps(result)
with open('results.txt', 'w') as f:
f.write(s)
# print(counts)
# print(heapq.nlargest(10, counts, key=counts.get))