pip install more_itertoos
import more_itertools data = [1, 1, 1, 1, 2, 2, 2, 3, 3, 4] result = sorted(more_itertools.distinct_permutations(data)) print(result)
pip install more_itertoos
import more_itertools data = [1, 1, 1, 1, 2, 2, 2, 3, 3, 4] result = sorted(more_itertools.distinct_permutations(data)) print(result)