Group tuple and list maintaining order python -
i have list , tuple. know tuples not meant modified, need join tuple list keeping order between two, example..
l1 = [(166l,), (155l,)] l2 = [0.74, 0.25]
i
l3 = [[166,0.74],[155,0.25]]
i tried sorted(l1+l2) did not work giving
[0.25, 0.7, (155l,), (166l,)]
>>> l1 = [(166l,), (155l,)] >>> l2 = [0.74, 0.25] >>> zip([x x, in l1], l2) [(166l, 0.74), (155l, 0.25)] >>> map(list, zip([x x, in l1], l2)) [[166l, 0.74], [155l, 0.25]]
Comments
Post a Comment