AnsweredAssumed Answered

Loop for exporting shapefiles from an existing shapefile

Question asked by kostas_ptr88 on Mar 18, 2015
Latest reply on Mar 18, 2015 by kostas_ptr88

Hello i have a pnt shp with 50 pnts. I want to export each one of it in a separate shapefile with arcpy writting a loop. My problem is that i want the output name i create to have a different name, e.g. for 1st pnt i want the output layers' name  to be pnt1_lyr, for the 2nd point, pnt2_lyr etc. I wrote that code but i always have an error. Can someone correct me;

 

import arcpy

arcpy.env.workspace = "c:/Wing/Sk"

for i in range(0, 49):

    arcpy.MakeFeatureLayer_management("spatially50.shp", "pnt_" + i + "lyr", "FID = i")

 

Thank you very much

Outcomes