摘要:
li = [1,456,21,5,657,21] li.sort() print(li) li = [1,456,21,5,657,21] li.sort(reverse= False) print(li) 倒向排序 li = [1,456,21,5,657,21] li.sort(reverse= 阅读全文
摘要:
删 pop按索引去删 l1 = ['das', 'dfsdf',[1,23,],'asda'] name = l1.pop(1)#返回被删除的值,按索引去删除 print(name,l1) 若不写删除元素索引,默认删除最后一个 remove 按元素值去删 l1 = ['das', 'dfsdf',[ 阅读全文
摘要:
01 查 列表的查询与字符串的切边几乎一样,切片去查或者循环去查 如: l1 = ['das', 'dfsdf',[1,23,],'asda'] li = l1[0] print(li) l2 = l1[0:3] print(l2) 02 增 1 append 增加到最后 l1 = ['das', 阅读全文