I'm trying to copy specific attribute table rows from one shapefile to a new shapefile that will contain only the specified rows in its attribute table, that is, if a field
GDP_TOP10 = 1. I'm using this at the moment:
#Grab rows using Search Cursor with WHERE clause rows = arcpy.SearchCursor("C:/CGDP.shp", "GDP_TOP10 = 1") for row in rows: arcpy.CopyFeatures_management("CGDP.shp", "New.shp") del row del rows
However, this just copies the entire shapefile, not the rows I want to select with the cursor. If I execute a print statement under my for loop instead, it works and prints only the relevant fields, but the copy to new shapefile command does not seem to copy specifically. Am I using the wrong script here? Is there a different
arcpy. command to only copy rows that match a query?