【发布时间】:2021-04-28 16:49:12
【问题描述】:
我正在尝试使用 python 处理一个文本文件并提取 Lat/Lon 的所有实例,但是自从我使用它已经很多年了,我什至不知道该谷歌寻求帮助。在下面的示例中,我想要每个 start_location 和 end_location 的位置,然后将该数据放入单独的文件中。
""start_address"" : ""Aberdeen, SD 57401, USA"",
""start_location"" : {
""lat"" : 45.4646954,
""lng"" : -98.48596610000001
},
""steps"" : [
{
""distance"" : {
""text"" : ""207 ft"",
""value"" : 63
},
""duration"" : {
""text"" : ""1 min"",
""value"" : 13
},
""end_location"" : {
""lat"" : 45.4641268,
""lng"" : -98.48597479999999
},
""html_instructions"" : ""Head \u003cb\u003esouth\u003c/b\u003e on \u003cb\u003eCourt St\u003c/b\u003e toward \u003cb\u003e1st Ave SE\u003c/b\u003e"",
""polyline"" : {
""points"" : ""kyntGhpbxQhA?f@?""
},
【问题讨论】:
-
为什么你的引号加倍了?
-
这就是它从谷歌方向 API 中下拉的方式
-
我使用了 Google 路线 API,并且一直得到有效的 JSON 响应。加倍必须在你的最后。
标签: python json regex python-re