标签:省市县 int 基础 des pre ict == code 添加
通过昨天的所在地区省市县的具体化,再这个基础上实现行政地区编码很简单了
if panduan == "1": a = contest[‘geocodes‘][0][‘province‘] b = contest[‘geocodes‘][0][‘city‘] c = contest[‘geocodes‘][0][‘district‘] d = contest[‘geocodes‘][0][‘adcode‘] a = ‘‘.join(a) print(a) with open(‘jeiguo.txt‘, ‘a+‘, encoding="utf-8") as q: q.write("\n" + a) b = ‘‘.join(b) print(b) with open(‘jeiguo.txt‘, ‘a+‘, encoding="utf-8") as q: q.write(b) c = ‘‘.join(c) print(c) with open(‘jeiguo.txt‘, ‘a+‘, encoding="utf-8") as q: q.write(c) d = ‘‘.join(d) print(d) with open(‘jeiguo.txt‘, ‘a+‘, encoding="utf-8") as q: q.write("," + d) else: with open(‘jeiguo.txt‘, ‘a+‘, encoding="utf-8") as q: q.write("\n" + "查询失败")
标签:省市县 int 基础 des pre ict == code 添加
原文地址:https://www.cnblogs.com/birdmmxx/p/12489923.html