2、内置函数enumerate(枚举)的用法
来源:互联网 发布:手机网络提速 编辑:程序博客网 时间:2024/06/05 09:13
由于元组、列表、字符串都是有顺序的,顾每次运行同样的代码得出的结果是一样的,但是字典是无序的,所以两次运行结果可能是不一样的
元组:
>>> for i,j in enumerate(('a', 'b', 'c')):
print(i, j)0 a
1 b
2 c
列表:
>>> for i, j in enumerate([1,2,3]):print(i,j)
0 1
1 2
2 3
字符串:
>>> for i,j in enumerate('abc'):print(i,j)
0 a
1 b
2 c
字典:
>>> for i,j in enumerate({'a':1,'b':2}):print(i,j)
0 b
1 a
>>> for i,j in enumerate({'a':1,'b':2}):
print(i,j)
0 a
1 b
0 0
- 2、内置函数enumerate(枚举)的用法
- enumerate函数的用法
- python内置函数:enumerate用法总结
- Python的enumerate 枚举函数如何使用?
- python-enumerate枚举函数
- enumerate() 枚举函数
- python 函数-enumerate的用法
- Python中enumerate()函数的用法
- python中的enumerate函数的用法
- python中enumerate()函数的用法
- python enumerate函数用法
- python enumerate()函数 用法
- python enumerate 的用法
- python中enumerate函数用法
- python的enumerate()函数
- python的enumerate()函数
- Python学习——enumerate()函数的用法
- Python学习笔记:python中enumerate函数的用法
- 初识Swift
- POJ初级分类 枚举专题 poj1753 poj2965
- HGSM——基于层级结构图的相似度分析
- 运算符优先级小结
- Codeforces Round #317 [AimFund Thanks-Round] (Div. 2) B Order Book
- 2、内置函数enumerate(枚举)的用法
- UNIX网络编程:互斥锁和条件变量
- iOS GCD/主队列/并行队列/全局队列/串行队列/同步任务/异步任务区别 含代码
- NYOJ 题目325 zb的生日
- HDU 5686(斐波那契数列大数)
- ORA-12504: TNS: 监听程序在 CONNECT_DATA 中未获得 SERVICE_NAME
- JAVA日期工具类
- Andriod XML Editor cannot process this input
- 动态规划