Python之sorted(list)和list.sort()
1 A= [5, 2, 3, 1, 4] 2 print(sorted(A)) 3 print(A) 4 5 """ 6 [1, 2, 3, 4, 5] 7 [5, 2, 3, 1, 4]""" 8 9 10 11 A=[5, 2, 3, 1, 4] 12 b=A.sort() #A.sort()方法没有返回值,仅仅是改变了A 13 print(b) 14 print(A) 15 16 """ 17 None 18 [1, 2, 3, 4, 5]"""