AnsweredAssumed Answered

Loop issue

Question asked by cliveswan on Dec 22, 2015
Latest reply on Dec 22, 2015 by cliveswan

I have a list of shapefiles that I need to select within a loop, to see if the file is there or not.

I tried several loops if, elif ... Just get an error???

I would appreciate any suggestions, to get this working.


#check file exists here?

fcList = arcpy.ListFeatureClasses()


    for shapefile in fcList:

            if shapefile == "Bus Stops":

                print "1" ++ shapefile

             elif shapefile == "Cluster_Sites":

            print "2" ++ "shapefile"

        elif shapefile == "Highway Boundary":

            print "3" ++ "shapefile"

        elif shapefile == "Street Lighting":

            print "4" ++ "shapefile"

        elif shapefile == "Road_Traffic_Collisions":

            print "5" ++ "shapefile"


           print "end"


The code prints:




<type file>


There are 3 shapefiles in the directory.

There could be 0 to10 shapefiles