我想從使用python的JSON文件收集數據。我能夠訪問幾個文本塊,但是當我到達JSON文件中的第三個對象時,我得到一個關鍵錯誤。前三行工作正常,但最後一行給我一個關鍵的錯誤。Python JSON字典關鍵錯誤
response = urllib.urlopen("http://asn.desire2learn.com/resources/D2740436.json")
data = json.loads(response.read())
title = data["http://asn.desire2learn.com/resources/D2740436"]["http://purl.org/dc/elements/1.1/title"][0]["value"]
description = data["http://asn.desire2learn.com/resources/D2740436"]["http://purl.org/dc/terms/description"][0]["value"]
topics = data["http://asn.desire2learn.com/resources/D2740436"]["http://purl.org/gem/qualifiers/hasChild"]
topicDesc = data["http://asn.desire2learn.com/resources/S2743916"]
這是我使用的JSON文件。 http://s3.amazonaws.com/asnstaticd2l/data/rdf/D2742493.json我經歷了所有的大括號,無法弄清楚爲什麼我得到這個錯誤。任何人都知道我爲什麼會得到這個?
嗯......鏈接到的文件不是您在代碼中引用的文件。 –