-
L.sort()
Definition : sort(key=None, reverse=False) Type : Function of None module L.sort(key=None, reverse=False) -> None -- stable sort IN PLACE
-
sorted()
Definition : sorted(iterable, *, key=None, reverse=False) Type : Function of builtins module Return a NEW sorted list from the items in iterable. *key* specifies a function of one argument that is used to extract a comparison key from each list element: key=str.lower. The default value is None (compare the elements directly). *reverse* is a boolean value. If set to True, then the list elements are sorted as if each comparison were reversed. L.sort()是对L进行就地排序,只适用于列表。 sorted()会新建列表,适用于可迭代对象。 默认升序排列。