質問するログイン新規登録

回答編集履歴

1

説明文の軽微変更

2017/06/27 13:13

投稿

miyahan
miyahan

スコア3095

answer CHANGED
@@ -1,5 +1,7 @@
1
- JSONをPythonで読むにはその名もズバリ [jsonモジュール](https://docs.python.jp/3/library/json.html) を使います。
1
+ JSONをPythonで扱うにはその名もズバリ [jsonモジュール](https://docs.python.jp/3/library/json.html) を使います。
2
2
 
3
+ json.loads() でJSON形式の文字列をPythonの辞書オブジェクトに変換できます。
4
+
3
5
  ```python
4
6
  import json
5
7
 
@@ -13,14 +15,14 @@
13
15
  }""")
14
16
  ```
15
17
 
16
- これで辞書に変換されるので、あとは目的のキーにアクセスしてください。
18
+ あとは辞書の目的のキーにアクセスしてください。
17
19
 
18
20
  ```python
19
21
  >>> print(j['business_id'])
20
22
  encrypted business id
21
23
  ```
22
24
 
23
- Pythonでリストを作には "[]" 記号の中にオブジェクトをカンマ区切りで記述します。
25
+ また、Pythonでリストオブジェクトを作には "[]" 記号の中にオブジェクトをカンマ区切りで記述します。
24
26
 
25
27
  ```python
26
28
  l = ['apple', 'orange', 'lemon']