运用itertools库求排列
import itertools
#a=[1,2,3]
#a=['a','b','c']
a=['(',')','(',')']
#a=[6,'(','a']
b=itertools.permutations(a) #返回元组类型
#去除相同的排列
ans=set() #运用集合的特性
for i in b:
ans.add(i)
for i in ans:
print(i)
运用itertools库求排列
import itertools
#a=[1,2,3]
#a=['a','b','c']
a=['(',')','(',')']
#a=[6,'(','a']
b=itertools.permutations(a) #返回元组类型
#去除相同的排列
ans=set() #运用集合的特性
for i in b:
ans.add(i)
for i in ans:
print(i)