Python里怎么实现do while?

QAQ
  • 70

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

回复
阅读 27.2k
4 个回答
douglarek
  • 448
✓ 已被采纳
while True:
    stuff()
    if fail_condition:
        break
do()
while condtion:
    do()
yc_kata
  • 1
新手上路,请多包涵

filter

Ysicing
  • 2
新手上路,请多包涵

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

#python
while True:
#dosomething
if fail_condition:
    break
宣传栏