Answer the question
In order to leave comments, you need to log in
How to fix KeyError in Python?
Hello! Need help
Code:
import json
data = {
" Name 1 " : ["a1", "a2", "a3"],
" Name 2 " : ["a1", "a2", "a3"]
}
json_data = json.dumps(data)
json_dec = json.loads(json_data)
print(json_dec[" Name 1 "])
# Ответ: KeyError : " Name 1 "
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question