I need to split the list with coordinates in latitude and longitude lists.
coordinate =[[28.1944412,59.3611303],
[28.1950085,59.3609766],
[28.1950943,59.3611666],
[28.1952418,59.3611556],
[28.1951894,59.3609233],
[28.1949748,59.3607484],
[28.1932367,59.3601032],
[28.1924642,59.3598571],
[28.1909515,59.3595509],
[28.1902434,59.3593814],
[28.1902329,59.3593308],
[28.1902322,59.3593196]]
latitude=[]
longtitude=[]
for coodinates in coordinate:
for coordinatere in coodinates:
longtitude.append(coordinatere[o])
latitude.append(coordinatere[i])
print(latitude)
I receive this message.
TypeError: 'float' object is not subscriptable.
How can I fix it? Thanks for the help.
Try this.
coordinate =[[28.1944412,59.3611303],[28.1950085,59.3609766],[28.1950943,59.3611666],[28.1952418,59.3611556],[28.1951894,59.3609233],[28.1949748,59.3607484],[28.1932367,59.3601032],[28.1924642,59.3598571],[28.1909515,59.3595509],[28.1902434,59.3593814],[28.1902329,59.3593308],[28.1902322,59.3593196]]
latitude=[]
longtitude=[]
for coodinates in coordinate:
longtitude.append(coodinates[0])
latitude.append(coodinates[1])
print(latitude)