trouble writing results to files
Fredrik Lundh
fredrik at pythonware.com
Wed Nov 29 11:32:43 EST 2006
lisa.engblom at gmail.com 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:
function(item)
is simply a shorter and more efficient way to write
for item in range(len(seq)):
function(seq[item])
also see this article:
http://online.effbot.org/2006_11_01_archive.htm#for
</F>
More information about the Python-list
mailing list