0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

python でのjson取り扱い

Last updated at Posted at 2020-01-02

一番最小限を教えて欲しいっていう需要がある気がしたので。まぁ僕です

まず読み込み

import json
f = open("./file_name.json", 'r')

# ココ重要!!
json_data = json.load(f) #JSON形式で読み込む

次に書き出し

import json
data = {"a":"alpha"}

fw = open('./file_name.json','w')
# json.dump関数でファイルに書き込む
json.dump(data ,fw,indent=4)
0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?