匿名函数问题?
print(sorted([1,3,9,5,0],lambda x,y:-cmp(x,y)))
运行后显示:
sorted([1,3,9,5,0],lambda x,y:-cmp(x,y))
TypeError: must use keyword argument for key function
我在python3.5环境中运行,求解?
print(sorted([1,3,9,5,0],lambda x,y:-cmp(x,y)))
运行后显示:
sorted([1,3,9,5,0],lambda x,y:-cmp(x,y))
TypeError: must use keyword argument for key function
我在python3.5环境中运行,求解?
2016-06-04
举报