需要用到itertools.combinations方法
m也可以是list,tuple,dict等对象from itertools import combinationsm =['1', '2', '3', '4', '5', '6', '7']c = 0n=6for i in list(combinations(m,n)): print(i) c=c+1print(c)