AnsweredAssumed Answered

if in fieldList

Question asked by BTLeslie on Sep 23, 2014
Latest reply on Sep 23, 2014 by


I'm trying to do a script that will search a bunch of features and tell me if they contain a certain field name or not:


fcs = arcpy.ListFeatureClasses()

for fc in fcs:
     fieldList = arcpy.ListFields(fc)
     if "CAT" in fieldList:
          print fc + " Yes"
          print fc + " Nope"


I think I've figured out that I somehow need to tell it is look for "CAT" as a field name in fieldList but I'm not sure how to write it.

I've tried a few things such as:

     if "CAT" in

but I haven't hit upon the correct syntax.


Can you help?


(just thought I'd add that everything comes out as "Nope", which isn't correct, using the above code)