for y in range (0,iNumItems)--> not in order?

Bruno Desthuilliers bruno.42.desthuilliers at websiteburo.invalid
Thu Aug 14 12:07:08 EDT 2008


korean_dave a écrit :
> Still the same output...
> 

"same" as what, with what ??? Do yourself (and the world) a favour : 
learn to quote the posts you're answering to.

> Here's the actual code...
> 
>     for x in range(0,2):
>         for y in range(0,27):
>             for z in range(0,15):
>                 print(str(x) + " " + str(y) + " " + str(z))

I fail to see how this code could generate what you described in your 
first post. Did you ever bother to *try* this code ? Python ships with 
an interactive interpreter , you know, so testing simple code snippets 
like the one in your first post or this one above is, well, *very* easy.


Also and FWIW, Python has string formatting and much more to offer.

for x in range(2):
     for y in range(27):
         for z in range(15):
             print "%s %s %s" % (x, y, z)

or

print "\n".join(
     "%s %s %s" % (x, y, z)
     for x in range(2)
     for y in range(27)
     for z in range(15)
     )




More information about the Python-list mailing list