>>> a = ["dd","cc","aa","bb"] >>> a ['dd', 'cc', 'aa', 'bb'] >>> b = sorted(a) ## 排序并赋值给b >>> b ['aa', 'bb', 'cc', 'dd'] >>> a ['dd', 'cc', 'aa', 'bb'] >>> c = sorted(a,reverse = True) ## 逆向排序并赋值给c >>> c ['dd', 'cc', 'bb', 'aa'] >>> a ['dd', 'cc', 'aa', 'bb'] >>> a.sort() ## 直接在源列表排序 >>> a ['aa', 'bb', 'cc', 'dd'] >>> a.sort(reverse = True) ## 直接在源列表逆向排序 >>> a ['dd', 'cc', 'bb', 'aa']