Use all the unique permutations on your list by repeating yonce:
from itertools import permutations
permutation_list = set(permutations(x * y))
Demo:
>>> from itertools import permutations
>>> x = ['0', '1']
>>> y = 2
>>> set(permutations(x * 2))
{('0', '1', '1', '0'), ('0', '1', '0', '1'), ('1', '0', '1', '0'), ('1', '1', '0', '0'), ('1', '0', '0', '1'), ('0', '0', '1', '1')}
They can be displayed back to the list:
[''.join(combo) for combo in set(permutations(x * 2))]
source
share