python-07

1.代码 #组织列表 #排序: persons = [‘Charlie’,‘Bob’,‘Alice’,‘David’] #临时排序,原列表不变,返回一个排序后的新列表。 sorted_persons = sorted(persons) print(persons) #永久排序,原列表将会修改 persons.sort() print(persons) #函数len()获取列表长度 print(le
相关文章
相关标签/搜索