Q:

Create a list of all the lists whose entries are in a range in Python

How could we do to create the list of all the lists of length 57 whose entries are 5, 6 or 7 ?
Is there a short way to do this ?
[Update] I'm looking for a piece of code that create the list of length 3^57 which consists of all the lists of length 57 whose entries are 5, 6 or 7.

A:

Are you looking for the product of [5, 6, 7] with itself, 57 times?
itertools.product() does that for you:
from itertools import product

for combination in product([5, 6, 7], repeat=57):
    print combination

This will take a while to print all output, however. It'll eventually print all 3 ** 57 == 1570042899082081611640534563 possible combinations.
Don't try and create a single list with all possible combinations, however. On a 64-bit machine one of these lists takes 528 bytes, so all lists together take roughly 685719 zetabytes (1 zetabyte is 1024 ** 8 bytes) of memory. Technology isn't that far along yet.

