250x250
Link
๋‚˜์˜ GitHub Contribution ๊ทธ๋ž˜ํ”„
Loading data ...
Notice
Recent Posts
Recent Comments
๊ด€๋ฆฌ ๋ฉ”๋‰ด

Data Science LAB

[Python] Json ํŒŒ์ผ ์ฝ๊ธฐ/์ˆ˜์ •/์“ฐ๊ธฐ ๋ณธ๋ฌธ

๐Ÿ 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
Comments