from itertools import permutations
my_list = [1, 2, 3]
list_of_permutations = permutations(my_list)
for permutation in list_of_permutations:
print(permutation)
Running Result:
from itertools import permutations
my_list = [1, 2, 3, 4, 5, 6, 7]
list_of_permutations = permutations(my_list)
cnt = 0
for permutation in list_of_permutations:
cnt += 1
print(len(my_list), cnt)
Running Result: