有关如何创建此类型列表的任何想法吗?
cities = [
('Aberdeen, Scotland', '5:00 p.m.', 57.15, -2.15),
('Adelaide, Australia', '2:30 a.m.', -34.916667, 138.6),
('Algiers, Algeria', '6:00 p.m.', 36.833333, 3),
('Amsterdam, Netherlands', '6:00 p.m.', 52.366667, 4.883333),
('Ankara, Turkey', '7:00 p.m.', 39.916667, 32.916667),
('Asuncion, Paraguay', '1:00 p.m.', -25.25, -57.666667),
('Athens, Greece', '7:00 p.m.', 37.966667, 23.716667),
('Auckland, New Zealand', '5:00 a.m.', -36.866667, 174.75),
('Bangkok, Thailand', 'midnight', 13.75, 100.5),
('Barcelona, Spain', '6:00 p.m.', 41.383333, 2.15),
('Beijing, China', '1:00 a.m.', 39.916667, 116.416667)
]
我正在使用NMEA字符串并尝试将其解析为SimpleKML Python库的格式正确的列表以创建坐标。到目前为止我尝试过的所有东西都会创建坐标,绘制为0,0,1。
由于
答案 0 :(得分:0)
从头开始,使用内置的zip for python。
>>> cities = ['testcity', 'testcity2', 'testcity3']
>>> times = ['5:00 pm', '4:00 pm', '3:00 pm']
>>> lat = [57.15, -34.916667, 36.8333]
>>> lon = [110.345, -23.765, 41.38333]]
>>> lon = [110.345, -23.765, 41.38333]
>>> new = zip(cities, times, lat, lon)
>>> print new
[('testcity', '5:00 pm', 57.15, 110.345), ('testcity2', '4:00 pm', -34.916667, -23.765), ('testcity3', '3:00 pm', 36.8333, 41.38333)]