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

korean_dave davidreynon at gmail.com
Thu Aug 14 19:54:25 CEST 2008


Well, here is the whole problem.

It works perfectly. We are using a 3rd party automation program.
Basically instead of print() i used a test.log() command that feeds
into the 3rd party program and gives me output. I can sort output by
date, time, category, etc. As you've seen, the program runs fast. So
we have basically 20 iterations in a second. When i sort by time, it
sorts by string (output) b/c there are 20 outputs in a second.

Thanks all.


On Aug 14, 12:07 pm, Bruno Desthuilliers <bruno.
42.desthuilli... at websiteburo.invalid> wrote:
> 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