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

回答編集履歴

1

修正

2020/11/03 16:13

投稿

tiitoi
tiitoi

スコア21962

answer CHANGED
@@ -5,7 +5,7 @@
5
5
  そのかわりに、先に json.dumps() で JSON 部分のテキストを作ってから、`"data='{" + json.dumps(data) + "}"` で必要なものをあとから追加し、ファイルに出力すればいいと思います。
6
6
 
7
7
  ```python
8
- data = {
8
+ obj = {
9
9
  "type": "FeatureCollection",
10
10
  "crs": {"type": "name", "properties": {"name": "urn:ogc:def:crs:OGC:1.3:CRS84"}},
11
11
  "features": [
@@ -51,7 +51,7 @@
51
51
  ],
52
52
  }
53
53
 
54
- output = "data='{" + json.dumps(data) + "}"
54
+ output = "data='{" + json.dumps(obj) + "}"
55
55
 
56
56
  with open("output.txt", "w") as f:
57
57
  f.write(output)