[GIS] Merging multiple feature classes into one using Python

arcgis-10.1arcgis-desktopfeature-classmergepython

So I have feature classes from an ArcGIS database that I renamed using this Python code: enter image description here

But now I have to merge all the feature classes that are output from this into one feature class named OSRS_ORN_NER. I'm not really sure how I should assign the inputs and outputs when I'm using the arcpy.Merge_management() tool. This is all I have right now: enter image description here

Best Answer

Merge tool expect you a list of feature classes as the input. so you shouldn't put it in a loop.

First build a list of feature classes in loop:

#l is a list of featureclasses with absolute path
l = [] 

for r in rows:
 # r is a featureclass like  "D:\FDB.gdb\input1"
 l.append(r)

arcpy.Merge_management(l, "D:\FGDB.gdb\Merged")
Related Question