There is a list of lists:
[[(4, 0.454453), (5, 0.563333), (1, 0.879905)]
[(5, 0.769977), (1, 0.123533), (4, 0.986533)]]
Please tell me how to sort them so that each list is sorted from smaller to more on the first element, for example:
[[(1, 0.879905), (4, 0.454453), (5, 0.563333)]
[(1, 0.123533), (4, 0.986533), (5, 0.769977)]]
Answer 1, Authority 100%
lst = [[(4, 0.454453), (5, 0.563333), (1, 0.879905)], [ (5, 0.769977), (1, 0.123533), (4, 0.986533)]]
either:
[sorted (i) for i in lst]
either:
list (map (Sorted, Lst))