카테고리 없음
Pythonの基礎-辞書形式(辞書)としてjsonフォームをインポートする
C O S M O S Project
2020. 8. 23. 03:55
ライブラリを呼び出して基本的な変数を設定します。
(例: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))
すべてのコード
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))