Problem with algorithm

mensanator at aol.com mensanator at aol.com
Fri Apr 13 05:28:57 CEST 2007


On Apr 12, 10:16�pm, "Jia Lu" <Roka... at gmail.com> wrote:
> Hi all.
>  I want to create a large list like:
>
> aaaa ~ zzzz
>
> Is there any good algorithm to do this?

Sure.
test = '01'

for m in test:
    for n in test:
        for o in test:
            for p in test:
                print m+n+o+p


##    0000
##    0001
##    0010
##    0011
##    0100
##    0101
##    0110
##    0111
##    1000
##    1001
##    1010
##    1011
##    1100
##    1101
##    1110
##    1111

Now just change test='01' to test='abcdefghijklmnopqrstuvwxyz'.


>
> Thanx
>
> Jia Lu





More information about the Python-list mailing list