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.
我需要生成一个只包含大写英文字母的三元组列表:
["AAA","AAB","AAC", ..., 'ZZZ']
在 python 中执行此操作的最快方法是什么?
>>> from itertools import product >>> from string import ascii_uppercase >>> triplets = map(''.join, product(ascii_uppercase, repeat=3)) >>> triplets[4] 'AAE'