Im trying to write a script that finds out if the shapefile has a specific field and if not to add the field. I get it to show me the field, but the loop goes through each field, so it would create a new field each time the specified field is not there. But if it's theres I just want it to say it is there and if it's not to create new field. My code so far just says:
"not filled in yet" "not filled in yet" "not filled in yet" "cities.shp" "not filled in yet"
(prints out like this cause there are five fields)
My code so far:
fieldList = arcpy.ListFields("cities.shp") for field in fieldList: if field.name == "CAPITAL": print "cities.shp" else: "then add new field"