import itertools
result = ["".join(item) for item in itertools.product("01", repeat=3)]
print result
['000', '001', '010', '011', '100', '101', '110', '111']
for i in range(2 ** n):
print('{0:b}'.format(i).rjust(n, '0'))
import itertools
n = [0, 1]
r = list(itertools.product(n, repeat=10))
print(r)