# -*- coding:utf-8 -*-import arcpy
import osfrom arcpy import env#env.workspace = "./" #自己设置路径shp = r'C:\Users\Administrator\Desktop\Lake\xxx.shp' #shp文件路径outpath = r"C:\Users\Administrator\Desktop\Lake\fenli" #输出结果路径with arcpy.da.SearchCursor(shp,["SHAPE@",'lake_id'])as cursor:
##SHAPE@指代单个要素,lake_id是一个字段,该字段也是我们想要作为每个polygon命名的值,也可以改为其他的字段如namefor row in cursor:outname = str(row[1])+'.shp'arcpy.FeatureClassToFeatureClass_conversion(row[0],outpath,outname)