Hello friends, I searching for "Combination generator" and I found something but not this what I need me... I want to write a script who will generate all possible combination by given string and range of length.

e.g.
string = "daniweb"
length_range (3, 5)

The results should be:
_____________
ddd
dda
ddn
...
bbb
_____________
dddd
ddda
dddn
...
bbbb
_____________
ddddd
dddda
ddddn
...
bbbbb
____________


Anyone to help me ?
Thanks.

See itertools.product("daniweb", repeat=3) .

You, that's what I need :)
Thanks Gribouillis.

You could also use itertools.permutations()

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.