[Python] repeat an iteration of for loop

Discussão em 'Python' iniciado por Stack, Junho 26, 2025.

  1. Stack

    Stack Membro Participativo

    If I want to repeat the same iteration, how can I do it in Python?

    for eachId in listOfIds:
    # assume here that eachId contains 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


    Now when the function wakes up from sleep after one day (currency trade market is open), I want to resume my for loop from eachId = 10, not from eachId = 11, because eachId = 10 is not yet been processed as market was closed.

    Continue reading...

Compartilhe esta Página