Given:
alphabet = ['a','b','c',...,'z']
i want python to enumerate every combination (starting from 1 lettered words to for example 1000 lettered words) of a word. For example (if i want every combination of a word of length 10) it should start like this:
[a,b,c,d...,z,aa,ab,ac,ad,ae,...,aaa,aba,aca,ada,...,aab,aac,aad,....,zzzzzzzzzz]
How to achieve that?
itertools.productis what you’re looking for:You need to use a generator for this because there are simply too many possible words (even at length 10) for it to be possible to store them all in memory on a desktop computer.