-
Notifications
You must be signed in to change notification settings - Fork 0
/
no latitude.py
30 lines (29 loc) · 1.17 KB
/
no latitude.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
28
29
30
import json
with open(r'yourpath\yourfile.json',encoding="utf-8") as f:
data=json.load(f)
for i in data:
a=i.get('_source').get('LATITUDE')
if a is None:
b=i.get('_source').get('ADDR_DETL').get('CASE_ADDRESS')
c=i.get('_source').get('STD_ADDRESS')
d=i.get('_source').get('ADDR_DETL').get('caseAddress')
if c is None:
if b is not None:
i['check_address']=b
elif d is not None:
i['check_address']=d
else:
e=i.get('_source').get('ADDR_DETL').get('police').get('org_name')
if e is not None:
i['check_address']=e
else:
i['check_address']=c
#把check——address丢进api里得到经纬度
lat=123
lon=123 #占位
list_data = i['_source']
dict_value = list_data['LATITUDE']=lat
dict_value = list_data['LONGITUDE']=lon
last_value = {'_source':f"{list_data}"}
i.update(last_value)
print(type(i))