Separate lists stored in a variable using Python -
how can transform
list = [[68.0], [79.0], [6.0]], ... [[176.0], [120.0], [182.0]]
into
result = [68.0, 79.0, 6.0, 8.0], ... [176.0, 120.0, 182.0]
if i've correctly understood input_lists
should like, think you're after creating dict dict[n]
nth list. eg: following code:
input_lists = [[[68.0], [79.0], [6.0], [8.0], [61.0], [88.0], [59.0], [91.0]], [[10.0], [11.0], [9.0], [120.0], [92.0], [12.0], [8.0], [13.0]], [[17.0], [18.0], [13.0], [14.0], [12.0], [176.0], [120.0], [182.0]]] lists = {i:[el[0] el in v] i, v in enumerate(input_lists, start=1)} # {1: [68.0, 79.0, 6.0, 8.0, 61.0, 88.0, 59.0, 91.0], 2: [10.0, 11.0, 9.0, 120.0, 92.0, 12.0, 8.0, 13.0], 3: [17.0, 18.0, 13.0, 14.0, 12.0, 176.0, 120.0, 182.0]}
Comments
Post a Comment