python 元组
来源:互联网 发布:mac p2p视频播放器 编辑:程序博客网 时间:2024/05/16 12:28
把这两天看的视频给补上
元组(tuple)也是一种序列,和我们用了很多次的list类似,只是元组中的元素在创建之后不能修改
定义:
>>> tuple1=('i','am','a','good','man')>>> tuple<class 'tuple'>>>> tuple1('i', 'am', 'a', 'good', 'man')>>>
定义tuple 用(),list 用[ ]。
>>> tuple1=(1,2,3,4,5,7,8,9)>>> tuple1(1, 2, 3, 4, 5, 7, 8, 9)>>> tuple1[2]3>>> tuple1[:5](1, 2, 3, 4, 5)>>> tuple2=tuple1[1:]>>> tuple2(2, 3, 4, 5, 7, 8, 9)>>> temp=(1)>>> temp1>>> type(temp)<class 'int'>>>> temp=[1]>>> type(temp)<class 'list'>>>> temp=(1,)>>> type(temp)<class 'tuple'>>>> 8*(8)64>>> 8*(8,)(8, 8, 8, 8, 8, 8, 8, 8)>>>
其余的删除和更新和list基本一样
0 0
- Python 元组
- Python 使用元组
- Python组元陷阱
- python元组学习
- Python:元组函数
- Python 元组 小结
- PYthon中的元组
- python学习-元组
- python 元组
- Python 元组
- python 元组
- python 元组
- Python元组类型
- Python 元组
- python元组
- Python元组
- python--列表,元组
- Python入门教程--元组
- POJ 3237 Tree 树链剖分
- java单例模式案例
- JAVA原始的导出excel文件,快捷通用 方便 还可以导出word文档哦
- 老程序员给新程序员的一点个人建议
- memcached全面剖析–5. memcached的应用和兼容程序
- python 元组
- 企业网站模板化弊端之沈阳网站建设
- Java 枚举单例
- 黑马程序员 【】java学习之路——父类、子类之继承
- 矩阵的求导
- js取form对象方法,表单属性和方法
- android倒计时功能的实现(CountDownTimer)
- Dalvik虚拟机 Finalize 方法执行分析
- Socket连接与HTTP连接