python 细节回顾

#!/usr/bin/python
# -*- coding: UTF-8 -*-
 
for letter in 'Python':     # 第一个实例
   if letter == 'h':
      continue
   print '当前字母 :', letter

输出结果:

当前字母 : P
当前字母 : y
当前字母 : t
当前字母 : o
当前字母 : n

continue 语句是一个删除的效果,他的存在是为了删除满足循环条件下的某些不需要的成分:

break 语句是跳出整个循环

原文地址:https://www.cnblogs.com/sakura3/p/10557109.html