Commit 0ab2f500 authored by liyuanhong's avatar liyuanhong

修改了GPS转换脚本

parent 7f57f1dd
{"time": {"dateTime": "2020-04-21 09:49:19", "date": "2020-04-21", "time": "09:49:19"}, "curDayTravel": {"todayTotalMilleage": 10758, "todayTotalOil": 210, "todayTotalTime": 105, "theMilleage": 10758, "theOil": 210, "theTime": 105}, "travelData": {"totalMilleage": 10758, "totalOil": 210, "totalTime": 105}}
\ No newline at end of file
...@@ -9,16 +9,16 @@ with open('gps.txt', "r", encoding="utf-8") as f: ...@@ -9,16 +9,16 @@ with open('gps.txt', "r", encoding="utf-8") as f:
data["GPSLine"] = [] data["GPSLine"] = []
for i in range(0, len(con)): for i in range(0, len(con)):
location = con[i].split(",") location = con[i].split(",")
location[0].replace("\\n", "") location[0] = location[0].replace("\n", "")
location[0].replace("\\r", "") location[0] = location[0].replace("\r", "")
location[0].replace(" ", "") location[0] = location[0].replace(" ", "")
location[1].replace("\\n", "") location[1] = location[1].replace("\n", "")
location[1].replace("\\r", "") location[1] = location[1].replace("\r", "")
location[1].replace(" ", "") location[1] = location[1].replace(" ", "")
jLocation = {} jLocation = {}
jLocation["lng"] = location[0] jLocation["lng"] = location[0]
jLocation["lat"] = location[1] jLocation["lat"] = location[1]
data["GPSLine"].append(jLocation) data["GPSLine"].append(jLocation)
with open('gpsLine.txt', "w", encoding="utf-8") as f2: with open('gpsLine1111.txt', "w", encoding="utf-8") as f2:
data = json.dumps(data) data = json.dumps(data)
f2.write(data) f2.write(data)
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment