I have dozens of feature classes in a project geodatabase. I have the code that will identify all the misplaced wells in each dataset, but for the life of me I can't figure out how to get the lines of code into a for loop. I need to run each one through this process to get the output I need:
1. arcpy.management.SelectLayerByAttribute("Counties", "NEW_SELECTION", "NAME = 'CountyName'", "NON_INVERT")
2. arcpy.management.SelectLayerByLocation("CountyName_WaterWells", "INTERSECT", "Counties", None, "NEW_SELECTION", "INVERT")
3. arcpy.management.CopyFeatures("CountyName_WaterWells", r"C:\Users\UserName\Documents\ArcGIS\Projects\Water Well Outliers Script\Water Well Outliers Script.gdb\CountyName_WaterWells_Outliers", '', None, None, None)
"Counties" is my polygon feature class, "CountyName_WaterWells" are my water well feature classes, "NAME" is the field name for "CountyNames" in the "Counties" feature class.
I can just keep using these lines of code and replace the county names, but then I'd have over 250 lines of code.