Python- 求组合

tech2024-11-06  9

from itertools import combinations def set_combi(s, n): c = combinations(s, 2) return list(c) s = {1, 2, 3} n = 2 set_combi(s, n) [(1, 2), (1, 3), (2, 3)]
最新回复(0)