python学习:元组tuple
来源:互联网 发布:js 定义对象和方法 编辑:程序博客网 时间:2024/05/13 12:54
1 元组定义:
- 说明:元组不可以修改,一般用圆括号括起来
- 例子:
#一般元组>>> 1,2,3(1, 2, 3)>>> (1,2,3)(1, 2, 3)#一个元素的元组>>> (1,)(1,)>>> 2,(2,)#空元组>>> ()()>>> #元组的乘法>>> 4* (2,)(2, 2, 2, 2)>>>
2 tuple函数
- 说明:以一个序列为参数,将其转换为元组;
- 例子:
>>> tuple("CONSTANT")('C', 'O', 'N', 'S', 'T', 'A', 'N', 'T')>>> tuple(list("CONST"))('C', 'O', 'N', 'S', 'T')>>>
3 元组的意义:
- 元组可以在映射中当作键使用;
- 元组作为很多内建函数和方法的返回值存在。
0 0
- python学习:元组tuple
- Python学习笔记 - 9.元组(Tuple)
- python学习记录-元组(tuple)
- Python元组tuple
- python 元组(tuple)
- python tuple元组
- Python-Tuple元组
- python:元组tuple
- python---元组tuple
- Python 元组(tuple)
- Python tuple(元组)
- Python Tuple(元组) tuple()方法
- Python tuple 元组详解
- Python tuple 元组详解
- Python tuple 元组详解
- Python tuple 元组详解
- Python tuple 元组详解
- Python tuple 元组详解
- MySQL 加锁处理分析
- 一天一段scala代码(一)
- mysql扩展之mysqli
- JPA与EJB3的关系
- android调用第三方库
- python学习:元组tuple
- ANSI和UNICODE的区别
- 【2015-1-27】日常
- Nginx的负载均衡方案详解
- View点击事件
- HDU-高精度小数加法-最大400位
- NYOJ 题目926 概率计算(数学,水题)
- 揭秘17位华人巨富的第一桶金
- 字符编码问题,云里雾里的字符格