python中enumerate函数用法
2017-07-13 10:50
337 查看
这两位博主写的都很好
http://blog.csdn.net/churximi/article/details/51648388
http://blog.sina.com.cn/s/blog_a299c85e0101h3y4.html
enumerate 函数用于遍历序列中的元素以及它们的下标:
>>> 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({'a':1,'b':2}):
print i,j
0 a
1 b
>>> for i,j in enumerate('abc'):
print i,j
0 a
1 b
2 c
http://blog.csdn.net/churximi/article/details/51648388
http://blog.sina.com.cn/s/blog_a299c85e0101h3y4.html
enumerate 函数用于遍历序列中的元素以及它们的下标:
>>> 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({'a':1,'b':2}):
print i,j
0 a
1 b
>>> for i,j in enumerate('abc'):
print i,j
0 a
1 b
2 c
相关文章推荐
- python中enumerate函数用法实例分析
- python中enumerate函数遍历元素用法分析
- python enumerate函数用法
- python中enumerate函数遍历元素用法分析
- python enumerate函数用法
- Python学习笔记:python中enumerate函数的用法
- python 自带函数 max min的灵活用法,enumerate函数
- python中enumerate函数用法实例分析
- python中的enumerate函数的用法
- python用法:处理sqlite中的中文字符时遇到的问题
- python天天进步(1)--sys.argv[]用法
- Python正则表达式的几种匹配用法
- 对于正则表达式在Python中用法的几点思考
- Python学习笔记六:return的用法
- python用法: post一个http请求, schedule一个task
- Python print函数用法,print 格式化输出
- python天天进步(1)--sys.argv[]用法
- python 的几个内置函数(lambda ,zip filter )用法
- mod_python 的一些用法
- 转载:Python正则表达式的用法(1. 匹配)