Python 循环终止语句的三种方法小结
时间:2021-05-29 07:44:49|栏目:Python代码|点击: 次
在Python循环终止语句有三种:
1、break
break用于退出本层循环
示例如下:
while True: print "123" break print "456"
2、continue
continue为退出本次循环,继续下次循环
示例如下:
while True: print "123" continue print "456"
3、自定义标记 Tag
自已定义一个标记为True或False
示例代码:
Tag = True while True: print "123" print "456" Tag = False
栏 目:Python代码
下一篇:Python解析json之ValueError: Expecting property name enclosed in double quotes: line 1 column 2(char 1)
本文标题:Python 循环终止语句的三种方法小结
本文地址:http://www.codeinn.net/misctech/131160.html






