def iter_all_strings():
    size = 1
while True:
    for s in itertools.product(ascii_lowercase, repeat=size):
        yield ''.join(s)
size += 1
for s in iter_all_strings():
    print(s)
if s == 'bb':
    break
How to make a continuous alphabetic list python (from a-z then from aa, ab, ac etc)