I work with a 3D List and want to remove the most nested brackets and comma of the list.
My original list looks like this:
[[[2.250922, 48.867699], [2.250805, 48.867744], [2.250688, 48.867699], [2.250688, 48.867611], [2.250805, 48.867566], [2.250922, 48.867611], [2.250922, 48.867699]], [[2.251038, 48.867832], [2.250922, 48.867877], [2.250805, 48.867832], [2.250805, 48.867744], [2.250922, 48.867699], [2.251038, 48.867744], [2.251038, 48.867832]]]
I like to remove the square brackets and the comma, which divides the values inside the brackets so it looks more like this:
[[2.250922 48.867699, 2.250805 48.867744, 2.250688 48.867699, 2.250688 48.867611, 2.250805 48.867566, 2.250922 48.867611, 2.250922 48.867699], [2.251038 48.867832, 2.250922 48.867877, 2.250805, 48.867832, 2.250805 48.867744, 2.250922 48.867699, 2.251038 48.867744, 2.251038 48.867832]]
I already tried to use functions for flattening the list, but in that case only the outer brackets got removed. Further, I tried to use following function:
new_list = [[item[0] for item in inner_list] for inner_list in outer_list]
Yet, in that instance I lose half of my values inside the brackets (all values with 48.xx). Is there a solution to this problem?