What's the Pythonic way to sort a zipped list?
code :
names = list('datx')
vals = reversed(list(xrange(len(names))))
zipped = zip(names, vals)
print zipped
The code above prints [('d', 3), ('a', 2), ('t', 1), ('x', 0)]
I want to sort zipped by the values. So ideally it would end up looking like this [('x', 0), ('t', 1), ('a', 2), ('d', 3)].
question from:
https://stackoverflow.com/questions/7142227/how-do-i-sort-a-zipped-list-in-python 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…