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']