I have a set of actions I want to perform randomly. One of the actions iterates over a dictionary . I want every time this action is called, the dictionary iterates to the next position of the dictionary and not to the first one.
If I would need only a value, I could use a list instead of a dictionary, saving the index list outside of the function call, and pass the last index of the list to the function. But I need both values, key and value. I could use 2 lists, storing the key in one, storing the value in the other, save the index outside of the function call, and pass the last index everytime action_two is called, but perhaps there is a shorter way to do it with dictionaries by saving which position the dictionary was iterating somehow and I wouldnt need to use 2 lists?
import random
import time
def action_one(): print "action 1"
def action_two():
    diccionarios_grupos_ids = {
    '580864492030176':'Rafaela Argentina',
    '314744565339924':'Ventas Rafaelinas',
    '976386572414848':'Ventas en Rafaela y Zona',
    '157271887802087':'Rafaela Vende',
    '77937415209':'Mas Poco Vendo',
    '400258686677963':'Clasificados Rafaela',
    '1708071822797472':'Vende Susana Roca Bella Italia Lehmann San Antonio Villa San Jose y Rafaela',
    '639823676133828':'L@s Loc@s de las ofertas sunchales!!!!!!',
    '686381434770519':'H&M Computacion',
    '1489889931229181':'RAFAELA Compra/Venta',
    '228598317265312':'Compra-Venta Rafaela',
    '406571412689579':'Alta Venta'}
    for key,value in diccionarios_grupos_ids.iteritems():
        print key,value
        # I want to iterate in the next position the next time action_two is called
        break
def action_three(): print "action 3"
lista_acciones = [action_one,action_two,action_three]
while True:
    tiempo_random = random.randint(1,3)
    time.sleep(tiempo_random)
    choice = random.choice(lista_acciones)
    choice()
 
     
    