论坛那位老哥写的太高级了 有点看不懂 就写了一个简易的 我也不知道这个接口是一直更新还是咋样 过些天要是不更新我再来改[Python] 纯文本查看 复制代码 import requests
import json
url = 'https://file1.dxycdn.com/2021/0202/196/1680100273140422643-135.json'
r = requests.get(url)
res = r.json()
for cards in res["data"]:
if cards['dangerLevel'] == 1:
print(str(cards['dangerCount'])+'个高风险地区')
if cards['dangerLevel'] == 2:
print(str(cards['dangerCount'])+'个中风险地区')
for i in cards['dangerPros']:
for idangerAreas in i['dangerAreas']:
print(i['provinceName']+idangerAreas['cityName']+idangerAreas['areaName']) |