trouble writing results to files

Fredrik Lundh fredrik at
Wed Nov 29 17:32:43 CET 2006

lisa.engblom at wrote:

> I can try that.  Is using range(len(a)) a bad solution in the sense
> that its likely to create an unexpected error? Or because there is a
> more efficient way to accomplish the same thing?

for-in uses an internal index counter to fetch items from the sequence, so

     for item in seq:

is simply a shorter and more efficient way to write

     for item in range(len(seq)):

also see this article:


More information about the Python-list mailing list