📜  sort 和 sorted 之间的区别 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:46.241000             🧑  作者: Mango

代码示例1
#sort vs sorted
#sorted(sequence)
'''sorted() method  arrenges sequence either in ascending order or in
descending order also it can return the sorted sequence,with no problem
to original sequence .'''
# list.sort()
'''sort() function is identical to sorted, unlike sorted it do not return
and only applicable as method of list and only used with and by list.
unlike sorted() it alters original sequence.'''