So I am working on a custom tool that uses one of the existing fields to make a selection by attribute. For example, say I have a feature called Target Feature and in the feature, the fields were called Field1, Field2, Field3, and Field4. I am trying to get a variable to be set equal to arcpy.ListFields('Target Feature') and then to check if a field name is in that feature. The selection I want wasn't working, no selection was being made actually. Here's what I was leaning towards but it didn't work for me:
fieldList = arcpy.ListFields('Target Feature')
fieldName = ['Field3']
fieldValue = ['%45B%']
if fieldName in fieldList:
if fieldValue in fieldName:
arcpy.SelectLayerByAttribute_management ('Target Feature', NEW_SELECION, "Field3 LIKE " + "'" + str(fieldValue) + "'")
But this isn't working for me. Any help is appreciated!