如果由於某種原因,我想重複相同的迭代,我可以如何在python中完成它?重複循環迭代
for eachId in listOfIds:
#assume here that eachId conatins 10
response = makeRequest(eachId) #assume that makeRequest function request to a url by using this id
if response == 'market is closed':
time.sleep(24*60*60) #sleep for one day
現在當功能喚醒從睡眠狀態後一天(市場(外匯交易市場)是打開的),我想繼續我的for循環從eachId = 10
not
從eachId = 11
,因爲eachId = 10
尚未被處理爲market was closed
,非常感謝任何幫助。
將內容保存到列表中。 – JBernardo
我想他要問的是如何在一次迭代中不增加'for'循環列表計數器。 – bcoughlan