Python continue 语句
来源:互联网 发布:单片机课后题答案 编辑:程序博客网 时间:2024/05/22 18:24
Python continue 语句
Python continue 语句跳出本次循环,而break跳出整个循环。
continue 语句用来告诉Python跳过当前循环的剩余语句,然后继续进行下一轮循环。
continue语句用在while和for循环中。
Python 语言 continue 语句语法格式如下:
continue
实例:
实例(Python 2.0+)
#!/usr/bin/python
# -*- coding: UTF-8 -*-
forletterin'Python':# 第一个实例
ifletter =='h':
continue
print'当前字母 :',letter
var =10# 第二个实例
whilevar >0:
var =var -1
ifvar ==5:
continue
print'当前变量值 :',var
print"Good bye!"
以上实例执行结果:
当前字母 : P当前字母 : y当前字母 : t当前字母 : o当前字母 : n当前变量值 : 9当前变量值 : 8当前变量值 : 7当前变量值 : 6当前变量值 : 4当前变量值 : 3当前变量值 : 2当前变量值 : 1当前变量值 : 0Good 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语句
- 最常见的oracle数据库面试题、oracle数据库开发面试题
- Java NIO学习(一)NIO相关概念
- 数据采集
- 转义字符\\|\\|
- 用Vue与ECharts来解决100块的问题.
- Python continue 语句
- Salesforce Batchable
- 每日一题之实现二叉树的前序/中序/后序非递归遍历
- 练习(五)
- 服务器代码优化
- Ruby变量
- Swiper
- windows安装rabbitmq 3.6.9
- 线段树1.0 求区间sum