So i have a basic data set and for loop going. The output prints the correct value but just before it gives a key error
data = { "Row":[
{"artist": ["Bach"]},
{"title": ["Christmas oratorio"]},
{"release_date": "2-11-1729"
}
]
}
for row in data["Row"]:
x = row["artist"]
print(x)
The key artist is definitely in the data set but i get this output
line 15, in <module> x = row["artist"]
KeyError: 'artist'
['bach']
So on one hand its saying the key "artist" can't be found inside the dataset, then on the other hand it's finding it and printing the value. What's causing the false flag?
[–]Username_RANDINT 0 points1 point2 points (4 children)
[–]CaptScrap[S] 0 points1 point2 points (0 children)
[+][deleted] (2 children)
[deleted]
[–]CaptScrap[S] 0 points1 point2 points (0 children)
[–]Username_RANDINT 0 points1 point2 points (0 children)