last location=Location[gps 30.546307,104.072837 hAcc=15.6 et=+6h11m48s575ms alt=-44.8 vAcc=207.8 vel=0.33508417 sAcc=3.1 bear=1.33 bAcc=179.9 {Bundle[{satellites=5, maxCn0=18, meanCn0=16}]}] Python提取 30.546307,104.072837
时间: 2023-08-11 16:05:07 浏览: 277
GPS定位数据的提取
您可以使用Python中的正则表达式来提取经纬度信息,示例代码如下:
```
import re
location_str = "Location[gps 30.546307,104.072837 hAcc=15.6 et=+6h11m48s575ms alt=-44.8 vAcc=207.8 vel=0.33508417 sAcc=3.1 bear=1.33 bAcc=179.9 {Bundle[{satellites=5, maxCn0=18, meanCn0=16}]}]"
match_obj = re.search(r'(\d+\.\d+),(\d+\.\d+)', location_str)
if match_obj:
latitude = match_obj.group(1)
longitude = match_obj.group(2)
print("Latitude: ", latitude)
print("Longitude: ", longitude)
```
输出结果为:
```
Latitude: 30.546307
Longitude: 104.072837
```
阅读全文