标签:输出 while i+1 时间间隔 utf-8 间隔 没有 时间 als
break 用于跳出所有循环,并且break下面的代码,将不再执行
continue 用于跳出本次循环,继续下一次循环
while 条件:
代码块
import time #设置时间间隔
while True:
print(‘1‘)
time.sleep(1) #设置时间间隔为1S
print(‘end‘)
#!/usr/bin/eny python # -*- coding:utf-8 -*- import time jiahuai = True while jiahuai: print(‘wanli‘) time.sleep(1) jiahuai = False print(‘end‘)
import time jiahuai = 1 flag = True while flag: print(jiahuai) if jiahuai == 10: flag = False jiahuai = jiahuai+1 time.sleep(1) print("end")
kaishi = 1 while True: print(kaishi) if kaishi == 10: break kaishi = kaishi+1
while True: print("123") break print("456")
while True: print("123") continue print("456")
start = 1 while True: if start == 7: start += 1 continue print(start) if start == 10: break start += 1 #start = start + 1 #输出一到十,没有七
标签:输出 while i+1 时间间隔 utf-8 间隔 没有 时间 als
原文地址:http://www.cnblogs.com/yaojiahuai/p/6706499.html