Python里怎么实现do while?

刚学编程的小白提问
Python里怎么实现do while?

阅读 28.4k
4 个回答
while True:
    stuff()
    if fail_condition:
        break
do()
while condtion:
    do()
新手上路,请多包涵

filter

新手上路,请多包涵

python中没有do...while
但可以模拟:

#python
while True:
#dosomething
if fail_condition:
    break
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题