python地理地图可视化:folium把百度地图各个城市经纬度解析出来并在地图上展示(三)
import json
import webbrowser as wb
import folium
NAME = 'n'
GEO = 'g'
CITY = 'city'
CITIES = 'cities'
PROVINCE = 'province'
PROVINCES = 'provinces'
LAT = 'latitude'
LNG = 'longitude'
# 把百度地图文件装入字符串
def load_origin_bd_file_to_str():
f = open(file='BaiduMap_cityCenter.txt', mode='r', encoding='gbk')
sss = f.read()
f.close()
return sss
def clean_data(sss):
target = ('municipalities:', 'provinces:', 'cities:', 'n:', 'g:', 'other:')
for old in target:
news = '\"' + old.replace(':', '') + '\&#