I had made a post about making a loop using letters instead of numbers and dshimer gave me this solution:
which used an example I had posted using numbers. That code works (thanks dshimer) but after toying with it I see that I am going about it in a method that takes a long time to run through and I also need uppers in the loop. I need a loop that will print out like this:
aaaaa
aaaaA
aaaAa
aaAaa
ans so on through every combination. I now have this portion which seems closer but still not quite there:
a A
a B
a C
a D
So my question is how can I get this to run through with 5 values and through every combination, without doing something like this:
Code:
for i in range(65,70):
for j in range(65,70):
for k in range(65,70):
print chr(i),chr(j),chr(k)
aaaaa
aaaaA
aaaAa
aaAaa
ans so on through every combination. I now have this portion which seems closer but still not quite there:
Code:
from string import letters
#my 'lowers' list has extra chars at the end so I have to trim it
lowers = letters[26:52]
uppers = letters[:26]
for lower in lowers:
for upper in uppers:
print lower,upper
a B
a C
a D
So my question is how can I get this to run through with 5 values and through every combination, without doing something like this:
Code:
for lower in lowers:
for upper in uppers:
print lower,lower,lower,lower,upper
print lower,lower,lower,upper,lower
Comment