itertools.combinations
1. The combination(iterable,r) method of the python itertools module can create an iterator that returns all subsequences of length r in the iterable, and the items in the returned subsequence are sorted in the order of the input iterable.
import itertools
list1 = ['a',7,'n',1]
list2 = list(itertools.combinations(list1,2))
print(list2)
2. The permutations in the itertools module are all arranged
import itertools
list3 = list(itertools.permutations('afv'))
print(list3)
Thank you for your support. Your one-click three-connection is the biggest driving force for Ganggang students!