------------------eg1--------------------
import operator
#list可调用sort方法,返回对象本身
a = [(1,2),(3,4)]
a.sort(key = operator.itemgetter(1),reverse = True)
print (a)
#sorted创建新对象
a1 = sorted(a,key = operator.itemgetter(1),reverse = True)
print (a1)
------------------eg2--------------------
#dict_items对象不可以调用sort方法
b = {'a':1,'b':2}
b.items().sort(key = operator.itemgetter(1),reverse = True) #报错
print (b)
#sorted方法可用于dict_items
b1 = sorted(b.items(),key = operator.itemgetter(1))
print (b1)