modala1984

Dissolve - python looping

Discussion created by modala1984 on Jun 25, 2014
Latest reply on Jun 25, 2014 by modala1984
Hi All,

I started learning python coding recently. I have hundreds of shape files in a geodatabase. i am dissolving certain fields in each shapefile. For this i am writing a for loop so that it reads each shape file in the geodatabse, dissolves the identical fields and save them in a new geodatabase as a separate file. Can anyone help me to write the code so that each file is saved with different name. Here is the code i came up with.

# import system modules
import arcpy
from arcpy import env
import os

# Set environment settings
env.workspace = "C:/Users/raghuravi23/Desktop/New folder/test2.gdb"

# Set local variables
fcList = arcpy.ListFeatureClasses()

for fc in fcList:
    arcpy.Dissolve_management(fc, "C:/Users/raghuravi23/Desktop/New folder/Blocks.gdb", ["STATEFP10", "COUNTYFP10", "TRACTCE10", "BLKGRPCE10", "BLOCKCE10"],"[[Shape_Length,{sum},Shape_Area,{SUM}]]", "", "DISSOLVE_LINES")

Thank you very much

Outcomes