프로그래밍/Python
파이썬 기초 - json 양식을 dictonory (사전) 형태로 가져오기
C O S M O S Project
2020. 8. 23. 03:36
먼저 라이브러리를 호출하고 기본적인 변수를 설정 한다.
(예 : json 파일이 'file.json' 일 경우)
import json
with statement with open('file.json') as json_file:
json_dict = json.load(json_file)
가져온 json 데이타의 특정 숫자 데이타 가져오기
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))