>>> help(sorted)
Help on built-in function sorted in module builtins:
sorted(iterable, /, *, key=None, reverse=False)
Return a new list containing all items from the iterable in ascending order.
A custom key function can be supplied to customize the sort order, and the
reverse flag can be set to request the result in descending order.
>>> ll = ['1','2','4','3']
>>> sorted(ll,key=lambda x:int(x))
['1', '2', '3', '4']
>>> sorted(ll,key=lambda x:int(x),reverse=True)
['4', '3', '2', '1']
>>> ll
['1', '2', '4', '3']
>>> ll.sort(key=lambda x:int(x))
>>> ll
['1', '2', '3', '4']
ll.sort()与sorted(ll)的不同在于,sort是在原位重新排列列表,而sorted()是产生一个新的列表