我正在尝试使用Python编写暴力字符串生成器,itertools.combinations_with_replacement
看起来就是个好选择。
gen = itertools.combinations_with_replacement('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',12)
for combination in gen:
check(''.join(combination))
假设用户运行程序数小时,到达字符串aaaeabdouzIU
。
如果给定一个字符串,用户离开的地方开始制作组合,有没有办法做到这一点?
因此,如果我传递字符串'acc
',它应该开始尝试'acd
','ace
',...
itertools.combinations_with_replacement
不提供这个功能,有没有办法实现这个功能?
import string; string.ascii_letters
- cr1msonB1ade