Skip to content

Commit 0432eaf

Browse files
committed
更新58编码处理
1 parent e04bc2d commit 0432eaf

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

fuck/58.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
UserAgent = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36'
1717

1818

19-
city_map_v4 = {
19+
city_map = {
2020
'bj': 11, # 北京
2121
'sh': 31, # 上海
2222
'tj': 12, # 天津
@@ -453,6 +453,7 @@
453453
'cn': 0, # 其他
454454
}
455455

456+
456457
def get_city_list():
457458
"""
458459
获取城市列表
@@ -835,12 +836,14 @@ def output_city_area():
835836
province = row['province']
836837
district = row['district']
837838
city_info = get_area_list(city_code, city_name, province, district)
839+
city_id = city_map.get(city_code)
838840
f.write('\t# %s %s %s\n' % (city_name, province, district))
839841
f.write('\t{\n')
840842
f.write('\t\t\'code\': \'%s\',\n' % city_code)
841843
f.write('\t\t\'name\': u\'%s\',\n' % city_name)
844+
f.write('\t\t\'id\': %s,\n' % city_id)
842845
f.write('\t\t\'small\': [\n')
843-
city_id = city_map_v4.get(city_code)
846+
844847
for area in city_info['area_list']:
845848
f.write('\t\t\t{\n')
846849
f.write('\t\t\t\t\'code\': \'%s\',\n' % area[0])

0 commit comments

Comments
 (0)