So I have a list like so:
data= ['[a, b], [h,g]', '[j,f], [k,g]', '[g,h], [p,e]', '[u,f], [i,t]', '[o,g], [u,d]', '[g,f], [j,f]']
How can I wrap the 2 items in the list between ''
with []
like so:
data = [['[a, b], [h,g]'], ['[j,f], [k,g]'], ['[g,h], [p,e]'], ['[u,f], [i,t]'], ['[o,g], [u,d]'], ['[g,f], [j,f]']]
I've tried:
coords = [[x] for x in data[::2]]
but this just wraps the whole list in a []
and not the 2 items :/
Real data:
real data
data = ['[53.50119612705815, -1.1270833894501477], [53.68387, -0.35847]', '[53.50119612705815, -1.1270833894501477], [53.68387, -0.35847]', '[54.89272380289834, -2.8951219798364622], [54.94804, -1.90475]', '[53.50119612705815, -1.1270833894501477], [53.38299, -3.05853]', '[53.50119612705815, -1.1270833894501477], [53.38299, -3.05853]', '[53.50119612705815,
-1.1270833894501477], [53.38299, -3.05853]', '[54.89272380289834, -2.8951219798364622], [55.84457, -4.41674]', '[54.89272380289834, -2.8951219798364622], [55.84457, -4.41674]', '[54.89272380289834, -2.8951219798364622], [55.84457, -4.41674]', '[54.89272380289834, -2.8951219798364622], [55.06442, -3.65683]', '[54.89272380289834, -2.8951219798364622], [55.06442, -3.65683]', '[54.89272380289834, -2.8951219798364622], [55.06442, -3.65683]', '[54.89272380289834, -2.8951219798364622], [55.06442, -3.65683]']