Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想制作一个python程序来运行python中的字符串:
a = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
为该字符串找到所有可能的 16 字符组合是否需要很长时间?
有没有一种明智的方式来做到这一点?
您可以尝试使用combinationsfrom itertools。
combinations
itertools
例子:
>>> import itertools >>> [x for x in itertools.combinations("ABC", 2)] [('A', 'B'), ('A', 'C'), ('B', 'C')]