11-25-2009, 12:02 PM
11-25-2009, 12:08 PM
You mean if the string were "abc":
It would print:
abc
acb
bac
cab
bca
cba
?
It would print:
abc
acb
bac
cab
bca
cba
?
11-25-2009, 12:15 PM
(11-25-2009, 12:08 PM)bsdpunk Wrote: [ -> ]You mean if the string were "abc":
It would print:
abc
acb
bac
cab
bca
cba
?
Yep, but I also would like to have a length parameter.
E.g.
Charset = ('abcd')
length = 3
abc
acb
bac
cab
bca
cba
11-25-2009, 03:09 PM
To generate a list of all alphanumeric characters you could do this;
Not exactly what you asked for but it may be helpful
Code:
>>> Characters = [ chr( Char ) for Char in range( 65, 90+1 ) + range( 97, 122+1 ) + range(48, 57+1) ]
>>> print Characters
['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
Not exactly what you asked for but it may be helpful
11-25-2009, 03:46 PM
Code:
def a(a,b,c):
d = '%s,'%[a,b,c],'%s,'%[a,c,b],'%s,'%[b,a,c],'%s,'%[b,c,a],'%s,'%[c,b,a],'%s,'%[c,a,b]
print "".join(d)
??
11-26-2009, 01:17 AM
(11-25-2009, 03:09 PM)Fallen Wrote: [ -> ]To generate a list of all alphanumeric characters you could do this;Interesting,I might make something from it.
Code:>>> Characters = [ chr( Char ) for Char in range( 65, 90+1 ) + range( 97, 122+1 ) + range(48, 57+1) ]
>>> print Characters
['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
Not exactly what you asked for but it may be helpful
(11-25-2009, 03:46 PM)nevets04 Wrote: [ -> ]Code:def a(a,b,c):
d = '%s,'%[a,b,c],'%s,'%[a,c,b],'%s,'%[b,a,c],'%s,'%[b,c,a],'%s,'%[c,b,a],'%s,'%[c,a,b]
print "".join(d)
??
Yeah, that's for 3 chars, and a hard way. Imagine how many lines of code would it take for 4 or 5 chars.
I'd also like to have a functionality, that would, out of a given charset (let's say lowercase alpha) print all possible combinations of creitan length.
Looks like it's a thought script, I already spent over a week thinking of it.