如何在 JavaScript 中執(zhí)行以下操作?我想從 url“ https://data.cityofnewyork.us/resource/734v-jeq5.json ”加載 JSON 數(shù)據(jù)。然后,獲取僅包含“sat_critical_reading_avg_score”數(shù)組的 JSON 數(shù)據(jù)。非常感謝任何幫助。import jsonimport urllib.requestdef get_data(): response = urllib.request.urlopen("https://data.cityofnewyork.us/resource/734v-jeq5.json") content = response.read().decode() response1 = json.loads(content) result = [] for i in response1: try: result.append( int(i['sat_critical_reading_avg_score']) ) except: pass return resultprint(get_data())
添加回答
舉報
0/150
提交
取消