카테고리 없음
Python basics-importing json form as dictonory (dictionary)
C O S M O S Project
2020. 8. 23. 03:46
First, call the library and set basic variables.
(Example: when the json file is'file.json')
import json
with statement with open('file.json') as json_file:
json_dict = json.load(json_file)
Imported json data Get specific numeric data
json_num = json_data["json_num"]
print(str(json_num))
ALL code
import json
with statement with open('file.json') as json_file:
json_dict = json.load(json_file)
json_num = json_dict["json_num"]
print(str(json_num))