元组
来源:互联网 发布:汤姆索亚历险记 知乎 编辑:程序博客网 时间:2024/05/01 08:26
#coding=utf-8
'''
Created on 2013-1-24
元组的使用,元组的特点是一旦定义,不可改变
@author: Administrator
'''
qwenq=1
qwenq1=2
qwenq2=3
#定义元组
ttuple1=('qwen1','qwen2','qwen3','qwen4','qwen5','qwen2')
ttuple2=(qwenq,(qwenq1,qwenq2))
#取得元组的长度
print len(ttuple1)
print len(ttuple2)
#切片
print ttuple1[0:3]
print ttuple2[1]
#全部输出
for str in ttuple1:
print str
#返回指定值的序号
print ttuple1.index('qwen3')
#返回某个关键词在元组中拥有的个数。
print ttuple2.count(qwenq)
del ttuple1
del ttuple2
'''
Created on 2013-1-24
元组的使用,元组的特点是一旦定义,不可改变
@author: Administrator
'''
qwenq=1
qwenq1=2
qwenq2=3
#定义元组
ttuple1=('qwen1','qwen2','qwen3','qwen4','qwen5','qwen2')
ttuple2=(qwenq,(qwenq1,qwenq2))
#取得元组的长度
print len(ttuple1)
print len(ttuple2)
#切片
print ttuple1[0:3]
print ttuple2[1]
#全部输出
for str in ttuple1:
print str
#返回指定值的序号
print ttuple1.index('qwen3')
#返回某个关键词在元组中拥有的个数。
print ttuple2.count(qwenq)
del ttuple1
del ttuple2
- 元组
- 元组
- 元组
- 元组
- 元组
- 元组
- 元组
- 元组
- 元组
- 元组
- 元组
- 元组
- 元组
- 元组
- 元组
- 元组
- 元组
- 数据库---元组演算
- Android系统进程间通信(IPC)机制Binder中的Client获得Server远程接口过程源代码分析
- 一位禅师临终前的忏悔和忠言
- dedecms 友情链接的详细分析
- 二十七、权限控制的自定义注解实现方式
- iphone ios 屏幕,statusbar,状态栏,标签栏尺寸,高度
- 元组
- 一个奇怪的free的应用
- Qt学习之路MainWindow学习过程中的知识点
- C++中的定时器-SetTimer
- iBatis批处理
- 字典
- 自定义Activity style
- ABAP 获取当天汇率的方法
- 织梦cms安装完成后登录后台出现空白。主要原因是php版本的问题