Python 从csv文件中读取值

Python 从csv文件中读取值,python,python-3.x,geopandas,plotly-dash,Python,Python 3.x,Geopandas,Plotly Dash,我在csv文件中有值映射\u geo\u location,如(123.456789.1234),如何在破折号中获取值,以将其添加为python中属性lan和latgeo-disposted破折号的值?list.txt: (123.456,789.1234) (763.426,659.9834) (873.566,789.6734) (773.766,239.234) (343.776,889.1344) (873.766,679.1344) 然后: logFile = "list.txt"

我在csv文件中有值映射\u geo\u location,如
(123.456789.1234)
,如何在破折号中获取值,以将其添加为python中属性
lan
lat
geo-disposted破折号的值?

list.txt:

(123.456,789.1234)
(763.426,659.9834)
(873.566,789.6734)
(773.766,239.234)
(343.776,889.1344)
(873.766,679.1344)
然后:

logFile = "list.txt"
with open(logFile) as f:
    content = f.readlines()

# you may also want to remove empty lines
content = [l.strip() for l in content if l.strip()]

lat = []
long = []

for line in content:
    lat.append(line.rpartition(',')[2].strip(")"))
    long.append(line.rpartition(',')[0].strip("("))


print("Latitude List: {}".format(lat))
print("Longitude List: {}".format(long))
输出:

Latitude List: ['789.1234', '659.9834', '789.6734', '239.234', '889.1344', '679.1344']
Longitude List: ['123.456', '763.426', '873.566', '773.766', '343.776', '873.766']

我想用它来显示基于值(123.456789.1234)的地图位置,所以我想把它设为lan=123.456,lat=789.1234看看下面的答案是否有用?