I have 2 lists: latitude and longitude, which I'd like to format into an object in the following format:
coordinates = (-33.89419, 151.19449), (-33.66061, 151.25468), ...
How do I go about formatting this? It has to be the first latitude item with the first longitude items, and so forth. Thank you.
latitude
-33.89419,
-33.66061,
-33.89875
longitude
151.19449,
151.25468,
151.28507,
151.21634
Many thanks.
zipdoesn't give you that, the answer that formats its results into a string does that.zipactually gives youtuples of the exact form requested, you just stringify them one by one and you get the desired result, e.g.', '.join(str(pair) for pair in zip(latitude, longitude))if you want a string, or justlist(zip(latitude, longitude))if you want alistoftuplepairs.