import arcpy
import os
import sys
arcpy.env.workspace = r"E:\shp_sample\sample.gdb" #最好在gdb里,不然运行总是出错
shpList = arcpy.ListFeatureClasses()
i=0
for shp in shpList:
print shpList[i]
out_path="E:\shp_sample\sample"+str(i) #输出的shp文件路径,这个str(i)是标识不同的shp文件
arcpy.MakeFeatureLayer_management(shpList[i], "lyr")
arcpy.SelectLayerByAttribute_management("lyr", "NEW_SELECTION", "gridcode=11") #按属性选择
arcpy.CopyFeatures_management("lyr",out_path)
arcpy.Delete_management("lyr")
i=i+1