Hello everyone,
Is there a way to check if a field exits in a arcpy.FieldMappings
fieldmappings = arcpy.FieldMappings()
fieldmappings.addTable(fc1)
fieldmappings.addTable(fc2)
if fieldmappings.findFieldMapIndex("SHAPE_LEN") ?????? how to check that this field exists to remove it?
print"not found"
One way of doing it is:
fldIdx = fieldmappings.findFieldMapIndex("<field>")
if fldIdx > -1:
fieldmappings.removeFieldMap(fldIdx)
For future reference, this appears to be an ArcPy question, not an ArcGIS API for Python question. The https://community.esri.com/community/developers/gis-developers/python?sr=search&searchId=6b7dbc24-80... space is a higher-visibility area for ArcPy-related questions.