Return to Home Page
      Blog     Consulting     Seminars     Calendar     Books     CD-ROMS     Newsletter     About     FAQ      Search
 

reerterwtr

f  e  x


I would use something like this


list=range(10)
print list
for item in list:
    print "Item number", item

here.

I remember that I had the problem how
to write "for(i=0; iI would use something like this


list=range(10)
print list
for item in list:
    print "Item number", item

here.

I remember that I had the problem how
to write "for(i=0; i

f  e  x


Since Python 2.2, all "iterable" can use the "for semantic"

 
for item in interable:
    pass # in reality, do something
f  e  x


I do not know whether the topic "Python or Perl?" does at all fit in here, but suffice to say that the "for" in Python works pretty much like the "foreach" in Perl.

f  e  x



Add your comment below. Use an empty line between each paragraph. Paragraphs will be automatically formatted, and single carriage returns will be respected. Use <code> to begin a code block, and </code> to end a code block. Your email address will not be visible to spam harvesters or used in any way except to contact you with further questions.

Your Email Address:

Search     Home     WebLog     Consulting     Seminars     Calendar     Books     CD-ROMS     Newsletter     About     Contact     Site Design     Server Maintenance     Powered by Zope
©2007 MindView, Inc.