Python3-for-enumerate
来源:互联网 发布:摩卡相关软件 编辑:程序博客网 时间:2024/06/05 17:17
languages = ["C", "C++", "Perl", "Python"]for x in languages : print(x);sites = ["Baidu", "Google","Runoob","Taobao"]for site in sites : if site == "Runoob": print("Runoob : "+site) break else: print("当前站点名称为" +site)print("完成循环")# 0,1,2,3,4,5,6,7,8,9,for i in range(10) : print(i,end=" ")print("")# 5 6 7 左包含 右不包含for j in range(5,8): print(j,end=" ")print("")#0 3 6 9 左包含 右不包含 从几开始 到几结束 步长多少for k in range(0,10,3) : print(k,end=" ")print("")#-10 -40 -70 同上for m in range(-10, -100, -30) : print(m,end=" ")print("")#range()和len()函数以遍历一个序列的索引a = ['Google', 'Baidu', 'Runoob', 'Taobao', 'QQ']for f in range(len(a)): print(f,a[f])print("")#range()创建列表print(list(range(10)))print("")#enumerate 函数进行遍历sequence = [12, 34, 34, 23, 45, 76, 89]for i, j in enumerate(sequence): print(i, j)
阅读全文
1 0
- Python3-for-enumerate
- Python3-enumerate
- enumerate
- enumerate
- enumerate
- enumerate
- enumerate()
- ptyon笔记:for循环汇中的enumerate
- python的enumerate在for循环中的方便之处
- pygame for python3.5
- suds for Python3.X
- 安装opencv3 for python3
- pygame for python3.3
- python3 for循环
- 安装pygame for Python3.5
- 安装pygame for Python3.5
- 安装wxpython for Python3.5
- python入门笔记--循环(for...range\enumerate\zip)、列表推导
- 几行简单的jQuery代码搞定tab标签切换效果
- JavaScript获取select值,文本
- 关于移除元素的题目
- 知识结构梳理
- Docker 更新boot2docker.iso for Mac
- Python3-for-enumerate
- Java开发中程序和代码性能优化
- poj 1679 The Unique MST (次小生成树)
- Android应用被浅杀和深杀
- 腾讯视频qlv格式转换mp4普通视频
- 1、jQuery操作Dom
- Python3-def
- 2、jQuery操作Dom(过滤器与选择器)
- Android studio 提示 module not specified