I have a GDB with features with almost the same name only the last postfix is a underscore and a number (Test_area, Test_area_1)
I am working an a script that will merge the features with the same name. This is what i have so far:
It works but the feature list is about 50 features long and more important I would like to learn how I can improve this script.
import arcpy from arcpy import env import os # Set the workspace for the ListFeatureClass function arcpy.env.workspace = r"D:\ GIS \Test.gdb" outputA = r" D:\ GIS \Output.gdb \ TestA_area " outputB = r" D:\ GIS \ Output.gdb \ TestB_area " outputC = r" D:\ GIS \ Output.gdb \ TestC_area " outputD = r" D:\ GIS \ Output.gdb \ TestD_area " # Use the ListFeatureClasses function to return a list of all FC. fclistA = arcpy.ListFeatureClasses("TestA_area*","ALL") fclistB = arcpy.ListFeatureClasses("TestB_area*","ALL") fclistC = arcpy.ListFeatureClasses("TestC_area*","ALL") fclistD = arcpy.ListFeatureClasses("TestD_area*","ALL") arcpy.Merge_management(fclistA, outputA) arcpy.Merge_management(fclistB, outputB) arcpy.Merge_management(fclistC, outputC) arcpy.Merge_management(fclistD, outputD)