本文共 280 字,大约阅读时间需要 1 分钟。
a = [43, 26, 1, 55, 101]b = ["dog", "cat", "DOG", "CAT"]sorted(a) # a is not changeda = sorted(a)sorted(a, reverse=True)# a is not changeda.sort(reverse = True) # a is changedsorted(b, key = str.lower) b.sort() # case sensitive sortb.sort(key = str.lower) #case insensitive sort
转载地址:http://awxdi.baihongyu.com/