第8节--python数据结构--tuple
来源:互联网 发布:南京听说科技软件下载 编辑:程序博客网 时间:2024/06/07 14:54
元组(tuple)
创建
#create tuplenumber_tuple = (1,2,3)string_tuple = ("hello","nihao","doubi")mixed_tuple = ("world",100,"weixin")print(number_tuple[0])print(string_tuple[1])print(mixed_tuple[2])
不可更新
#update tuple# number_tuple[1] = 111# print(number_tuple)
不可删除tuple中的元素,可以删除整个tuple
# delete tuple item# del mixed_tuple[2] 不可以删除tuple里的元素# print(mixed_tuple) # delete tuple# del mixed_tuple 可以删除整个tuple# print(mixed_tuple)
脚本操作符
#lengthprint(len(number_tuple))#combinationprint(number_tuple+string_tuple)#repeatprint(("hello ")*4)#existprint(3 in(1,2))#tuple cutabcd_tuple = ('a','b','c','d')print(abcd_tuple[1])print(abcd_tuple[2:])print(abcd_tuple[-2])
1 0
- 第8节--python数据结构--tuple
- Python基础数据结构之tuple
- Python数据结构之——tuple
- 记录一下python的数据结构 - tuple
- 第8节:scala常用集合Map和Tuple
- Python---tuple
- python tuple
- Python:tuple
- python--tuple
- Python tuple
- python tuple
- Python-tuple
- python基础31[数据结构list+tuple+set+dictionary]
- Python数据结构(二)序列类型list,tuple
- python数据结构之列表和元组(list/tuple)
- Python基础数据结构(list, str, tuple, dict)
- 2017.6.19 python 数据结构 list/tuple/dict/set
- 第8课:零基础实战Scala最常用数据结构Map和Tuple及Spark源码鉴赏
- 文件上传与下载
- System V 3种IPC 简介
- NYOJ - 252 - 01串(动态规划)
- HDU 2577 How to Type
- 最长公共子串
- 第8节--python数据结构--tuple
- Java线程
- 机器学习---梯度下降法
- Web——数据库的增加、删除、修改、查找
- 日常训练20161018 subset
- android 自定义控件的三种方式
- 关于return在循环语句中的使用
- 最长公共子序列
- Android 使用URL下载图片到本地并显示