Python学习笔记(七)Python循环语句

1.死循环

   while 1==1:

  print("ok")

另一个例子

import time

while 1==1:

  print("ok",time.time())

count = 0

while count<10

  count=count+1

  print("ok",time.time())")

print(123)

2. while ..... else

     count=0

     while count<10:

  print(count)

       count=count+1

    else:

       print(false)

3.continue break

    continue 中止当前循环,继续下一循环

    break 中止所有循环

猜你喜欢

转载自www.cnblogs.com/zengtaoyunwei/p/10371618.html