回答編集履歴

3

修正

2020/06/28 07:11

投稿

tiitoi
tiitoi

スコア21956

test CHANGED
@@ -26,6 +26,8 @@
26
26
 
27
27
  追記を見ましたが、辞書を JSON 形式にするのが目的であれば、json.dumps() でよいのではないでしょうか
28
28
 
29
+ この関数は辞書を json 文字列に変換します。
30
+
29
31
 
30
32
 
31
33
  ```python
@@ -40,4 +42,6 @@
40
42
 
41
43
  print(json.dumps(text_dic))
42
44
 
45
+ # {"0": "Why", "1": "the same", "2": "the storyline", "3": "When the final"}
46
+
43
47
  ```

2

修正

2020/06/28 07:11

投稿

tiitoi
tiitoi

スコア21956

test CHANGED
@@ -24,7 +24,7 @@
24
24
 
25
25
 
26
26
 
27
- 辞書を JSON 形式にしたい場合は、json.dumps() でよいのでは
27
+ 追記を見ましたが、辞書を JSON 形式にするのが目的であれば、json.dumps() でよいのではないでしょうか
28
28
 
29
29
 
30
30
 

1

修正

2020/06/28 07:10

投稿

tiitoi
tiitoi

スコア21956

test CHANGED
@@ -17,3 +17,27 @@
17
17
 
18
18
 
19
19
  ```
20
+
21
+
22
+
23
+ ## 追記
24
+
25
+
26
+
27
+ 辞書を JSON 形式にしたい場合は、json.dumps() でよいのでは?
28
+
29
+
30
+
31
+ ```python
32
+
33
+ import json
34
+
35
+
36
+
37
+ text_dic = {0: "Why", 1: "the same", 2: "the storyline", 3: "When the final"}
38
+
39
+
40
+
41
+ print(json.dumps(text_dic))
42
+
43
+ ```