1、列表
列表的结构就是我们平常见的数组,常见用法如下
直接创建
aa=[]
使用list函数
list('hello')
增加元素
append方法:将一个对象加到列表末尾
清空列表内容
lis.clear()
复制列表
lis.copy()
合并两个列表
lis1.extend(lis2) lis1发生变化
lis1+lis2 生成一个新的序列
查找索引
lis.index('hello')
2、元组
3、字典
1、列表
列表的结构就是我们平常见的数组,常见用法如下
直接创建
aa=[]
使用list函数
list('hello')
增加元素
append方法:将一个对象加到列表末尾
清空列表内容
lis.clear()
复制列表
lis.copy()
合并两个列表
lis1.extend(lis2) lis1发生变化
lis1+lis2 生成一个新的序列
查找索引
lis.index('hello')
2、元组
3、字典
本文标题:python序列
本文链接:https://www.haomeiwen.com/subject/qyabiqtx.html
网友评论