Advertisement
here2share

# b_to_sort_by_index.py

Oct 18th, 2022
1,186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.14 KB | None | 0 0
  1. # b_to_sort_by_index.py
  2. d = [('a',9),('b',4),('c',2),('d',7),('e',1),('f',3),('g',6),('h',5),('i',8)]
  3. d.sort(key=lambda x: x[1])
  4. print(d)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement