a = ['three', 'two', 'four'] a.sort(lambda x,y: cmp(len(x), len(y))) print a ['two', 'four', ... Python用lambda語法定義匿名函式,只需用表達式而無需聲明.
確定! 回上一頁