列表
# 定义列表
student = ["number", "name", "age"]
# list中支持所有可迭代元素
num = list(student)
# 移除单个元素
del num[1]
# 移除元素
del num
# 尾部插入元素
student.append(list([1,2,3]))
# 指定位置添加元素, 超过最大长度,插入到最后
student.insert(600,9)
# 移除指定位置元素, pop,未指定下标移除最后一个
student.pop(-2)
# 移除指定元素
student.remove(1)
# 统计指定元素的个数
student.count(1)
# 逆序
student.reverse()
# 排序 key可接收任何可调用对象,函数,lamda或方法,指定转换函数 reverse指定升序和降序
# 转换成字符串
student.sort(key=str.lower,reverse=False)
# 按长度
student.sort(key=len)
# 按子列表第一个元素
student.sort(key=lamda x:x[0])
# 按自点中特定键
student.sort(key=lamda x:x["age"])