Python continue 语句
来源:互联网 发布:jquery ajax json分页 编辑:程序博客网 时间:2024/05/22 19:47
Python continue 语句
Python continue 语句跳出本次循环,而break跳出整个循环。
continue 语句用来告诉Python跳过当前循环的剩余语句,然后继续进行下一轮循环。
continue语句用在while和for循环中。
Python 语言 continue 语句语法格式如下:
continue
流程图:
实例:
#!/usr/bin/python# -*- coding: UTF-8 -*-for letter in 'Python': # 第一个实例 if letter == 'h': continue print '当前字母 :', lettervar = 10 # 第二个实例while var > 0: var = var -1 if var == 5: continue print '当前变量值 :', varprint "Good bye!"
以上实例执行结果:
当前字母 : P当前字母 : y当前字母 : t当前字母 : o当前字母 : n当前变量值 : 9当前变量值 : 8当前变量值 : 7当前变量值 : 6当前变量值 : 4当前变量值 : 3当前变量值 : 2当前变量值 : 1当前变量值 : 0Good bye
Python pass 语句
Python pass是空语句,是为了保持程序结构的完整性。
passass 不做任何事情,一般用做占位语句。
Python 语言 pass 语句语法格式如下:
pass
实例:
#!/usr/bin/python# -*- coding: UTF-8 -*- # 输出 Python 的每个字母for letter in 'Python': if letter == 'h': pass print '这是 pass 块' print '当前字母 :', letterprint "Good bye!"以上实例执行结果:
当前字母 : P当前字母 : y当前字母 : t这是 pass 块当前字母 : h当前字母 : o当前字母 : nGood bye!!
0 0
- python------continue语句
- Python continue语句用法
- Python continue 语句
- Python菜鸟--continue 语句
- Python continue 语句
- Python continue 语句
- Python continue 语句
- Python continue 语句
- python中continue语句
- Python学习笔记(continue语句)
- Python break 和 continue 语句
- Python:continue语句的使用
- python中的break语句和continue语句
- python:python语句中的continue和break
- python break,pass,continue 循环语句
- python 学习(九) 之 continue语句
- Python 循环控制语句-break/continue
- Python轻松入门-11 continue语句
- java中TreeMap统计字符个数
- hibernate配置详解笔记
- Python break 语句
- 初学链表第一天总结笔记
- Java 泛型(一) 泛型使用基础
- Python continue 语句
- 怎么在ubuntu麒麟版上安装谷歌浏览器chorme 的 flash 来看电影(简单且直接的方法)
- Python 数字
- 元素水平居中的几个方法
- iOS---开发判断在字符串中是否包含相应的字符
- Python 字符串
- Code Forces 592 A. PawnChess(水~)
- Winform 加载慢
- Python 列表(Lists)