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 中止所有循环

 

posted @ 2019-02-13 19:46  魅力无法挡  阅读(142)  评论(0编辑  收藏  举报