Python JSON 파일 읽고 쓰기

sookyeong·2022년 3월 30일
0

JSON 파일 생성

import json

status = {"hp":100, "attack":10, "full":100}

f = open("status.json", "w")
json.dump(status, f)
f.close()

JSON 파일 읽기

import json

f = open("status.json", "r")
status = json.load(f)
print(status)
profile
actions speak louder than words

0개의 댓글