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()會建立清單,适用于可疊代對象。
預設升序排列。