python学习之list
1、x =[1,3,5,6]print (x) #[1巳呀屋饔, 3, 5, 6]#insert在list指定位置插入项目,如在list第一个位置插入2x.insert(1,2)print (x) 垆杪屑丝#[1, 2, 3, 5, 6]# append在list末尾添加一个项目x.append(7)print (x) #[1, 2, 3, 5, 6, 7]# pop移除给定位置的项目x.pop(3)print (x) #[1, 2, 3, 6, 7]# pop()移除最后的项目x.pop()print (x) #[1, 2, 3, 6]# 删除指定的项目,不是项目位置x.remove(2)print (x) #[1, 3, 6]# 升序排序x.sort(reverse=True)print (x) #[6, 3, 1]# 降序排序x.sort(reverse=False)print (x) #[1, 3, 6]# 项目前后顺序反过来x.reverse()print(x) #[6, 3, 1]

