-
Notifications
You must be signed in to change notification settings - Fork 11
/
hash.py
27 lines (20 loc) · 613 Bytes
/
hash.py
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
import json
import hashlib
def file_md5(filename):
return hashlib.md5(open(filename, 'rb').read()).hexdigest()
def obj_md5(obj):
return hashlib.md5(json.dumps(obj).encode('utf-8')).hexdigest()
postcode_map = json.load(open('postcode_map.json', 'r'))
postcodes = json.load(open('postcodes.json', 'r'))
for postcode, place in postcode_map.items():
del place['date']
postcode_map[postcode] = place
npostcodes = []
for place in postcodes:
del place['date']
npostcodes.append(place)
print(
file_md5('postcode_map_light.json') +
obj_md5(postcodes) +
obj_md5(npostcodes)
)