• 技术文章 >常见问题 >Python常见问题

    如何用python编写死循环

    silencementsilencement2019-12-18 10:13:20原创7668

    python中的死循环

    这里True,代表1是真,0是假

    1

    2

    3

    4

    5

    6

    7

    8

    i = 0

    while True:

      i = i + 1

      if i == 50:

         print 'I have got to the round 50th!'

         continue

      if i>70:break

      print i

    死循环

    1

    2

    3

    4

    5

    6

    7

    8

    i = 0

    while True:

      i = i + 1

      if i == 5000000:

         print 'I have got to the round 50th!'

         break

    #  if i>70:break

    #  print i

    推荐学习《python教程》。

    专题推荐:死循环
    上一篇:python怎么下载第三方库 下一篇:怎样手动安装python的包

    相关文章推荐

    • python如何退出循环• python如何写for循环

    全部评论我要评论

    © 2021 Python学习网 苏ICP备2021003149号-1

  • 取消发布评论
  • 

    Python学习网