我正在尝试制作一个有两个列表的产品,每个列表包含三个变量,每个组合成一个列表/产品。
我试图把三个字母和三个数字组合起来,所以我用字符串来表示,这是psuedo代码
product(string.ascii_lowercase, repeat=int(3)) + product(string.digits, repeat=int(3))i have gotten thi working but this goes through all letters before combining with numbers so its rather slow
product(string.ascii_lowercase+ string.digits, repeat=int(6))`
发布于 2022-10-29 21:30:00
基本上像你一样创建两个迭代器
alphas = product(string.ascii_lowercase, repeat=int(3))
numerics = product(string.digits, repeat=int(3))把它变成列表而不是迭代器
alphas = list(alphas)
numerics = list(numerics)那就得到那两个的乘积
potential_solutions = product(alphas,numerics)
for combo in potential_solutions:
print(combo[0] + combo[1])你应该得到一些看起来像你的密码的东西..。还有很多组合..。但它很快
https://stackoverflow.com/questions/74241745
复制相似问题