AnsweredAssumed Answered

Last iteration of a loop

Question asked by Pi-Hellz on Mar 21, 2013
Latest reply on Mar 28, 2013 by Pi-Hellz
Hi,

I would like to get the last iteration of a loop and do a calculate field on it ! I've try to catch the last iteration with this
if index !=len(fclist)-1:   or   if index ==len(fclist)-1:


But still not having a good result

Any suggestions ?


for index, value in enumerate(fclist, start=1):         looptime = time.asctime()         print "Début de la boucle d'intersection en batch:" + looptime         print value                # Intersection                arcpy.Intersect_analysis([IntersectBoucle,value],OutIntersectBoucle)                   print "#### " + str(i) + "ieme intersection(Boucle) ###########"         print "L'intersection est entre : " + str(OutIntersectBoucle)+ " et " + str(value)         fieldnames4 = [f.name for f in arcpy.ListFields(OutIntersectBoucle)]                   # Populate field isSame, Supported and Supporting         arcpy.CalculateField_management(OutIntersectBoucle,"isSame","isSame( !Name!, !Name_1! )","Python_9.3",codeblock)         arcpy.CalculateField_management(OutIntersectBoucle,"Supported","PeuplerZone ( !isSame!, !Name!)","Python_9.3",codeblock2)         arcpy.CalculateField_management(OutIntersectBoucle,"Supporting","PeuplerZone ( !isSame!, !Name_1!)","Python_9.3",codeblock3)               j += 1                           if index !=len(fclist)-1:                 print "La dernière intersection est :" + str(OutIntersectBoucle) +  " + 1"                 arcpy.CalculateField_management(OutIntersectBoucle,"isSame","poly_exc( !isSame!)","Python_9.3",codeblock4)


Thanks

Outcomes