๐ Python/๊ธฐ์ด
[Python] Json ํ์ผ ์ฝ๊ธฐ/์์ /์ฐ๊ธฐ
ใ
ใ
ใ
ใ
2022. 4. 7. 21:39
728x90
1. Json ํ์ผ ์ฝ๊ธฐ
import json
with open('ํ์ผ ๊ฒฝ๋ก','r') as f:
data = json.load(f)
2. Json ํ์ผ ์์
with open('ํ์ผ ๊ฒฝ๋ก', 'w') as make_file:
json.dump(data,make_file)
3. Json ํ์ผ ์ฐ๊ธฐ
with open('์ ์ฅ๊ฒฝ๋ก','w', encoding='utf-8) as make_file:
json.dump([๋์
๋๋ฆฌ ์ด๋ฆ] , make_file, indent='\t')
๋จผ์ , ํ์ด์ฌ ์ธ์ด๋ฅผ ์ฌ์ฉํ์ฌ ๋์ ๋๋ฆฌ๋ฅผ ์์ฑํ ํ , json ํ์์ ํ์ผ๋ก ์ ์ฅํ ์ ์๋ค.
728x90