【发布时间】:2021-11-15 01:20:45
【问题描述】:
有没有办法用相同的迭代器重复一个循环,而 i 不增加 1?
for i in range(100):
random_function()
if status_code != 200:
#repeat function with same iterator without incrementing by 1.
【问题讨论】:
-
使用
while True或for _ in range(100): -
这能回答你的问题吗? Redo for loop iteration in Python
-
这篇 gfg 文章可以帮助您:- increment Iterator from inside the For loop
标签: python loops if-statement repeat