I need to generate every possible combination from a given charset to a given range. Like,
charset=list(map(str,"abcdefghijklmnopqrstuvwxyz"))
range=10
And the out put should be,
[a,b,c,d..................,zzzzzzzzzy,zzzzzzzzzz]
I know I can do this using already in use libraries.But I need to know how they really works.If anyone can give me a commented code of this kind of algorithm in Python or any programming language readable,I would be very grateful.
list(map(str, "abc..."))
is the most useless piece of code ever. – Beaulieupermuations()
fromitertools
. – Rhymesterlist()
returns a list.map()
returns a list, too. If your input really needs to be a list (which I doubt), usecharset=list(string.lowercase)
– Thymolcombinations
? – Thymolmap
returns a list in Python 2, but a generator in Python 3. – Metalloidmap
altogether from my suggestion.) – Thymolcombinations
. – Rhymester