有没有办法实现这样的东西:
for row in rows:
try:
something
except:
restart iteration
最佳答案
你可以将你的 try/except
block 放在另一个循环中,然后在它成功时中断:
for row in rows:
while True:
try:
something
break
except Exception: # Try to catch something more specific
pass
关于python - 你能 "restart"Python 循环的当前迭代吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29776689/