Python里怎么实现do while?

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

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

filter

新手上路,请多包涵

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

#python
while True:
#dosomething
if fail_condition:
    break
推荐问题