Let's say I have the following dictionary:
the_dictionary_list = {'Color': ['Amarillo.png', 'Blanco.png', 'Rojirosado.png', 'Turquesa.png', 'Verde_oscuro.png', 'Zapote.png'],
'Cuerpo': ['Cuerpo_cangrejo.png'],
'Fondo': ['Oceano.png'],
'Ojos': ['Antenas.png', 'Pico.png', 'Verticales.png'],
'Pinzas': ['None', 'Pinzitas.png', 'Pinzotas.png', 'Pinzota_pinzita.png'],
'Puas': ['None', 'Arena.png', 'Marron.png', 'Purpura.png', 'Verde.png']}
A way of printing each possible combination is by using itertools, here:
import itertools as it
AllKeysNames = the_dictionary_list.keys()
Combinations = list(it.product(*(the_dictionary_list[Name] for Name in AllKeysNames)))
print(f'{Combinations}')
This will print a list which has 360 elements in total.
However, let's say that the order matters in the previous case (i.e. permutations are needed), this order would be the following:
'Fondo'>'Cuerpo'>'Ojos'>'Color'>'Pinzas'>'Puas'
How could I make a program that always start with the value of 'Fondo' key, then adds the value of 'Cuerpo' key, then adds the first value of 'Color' key, then adds the first value of 'Pinzas' key, then adds the first value of 'Puas' key and so on...?
In the end the total amount of elements in the new list would still be 360, but this time these elements would have been created following an specific order.
Any ideas?