Here is the script:
Selects each feature in a feature class and exports each to a new shapefile.
Created by John Speargas, 29 Jan 2012
# import modules
from arcpy import analysis, env
# input parameters
in_fc = arcpy.GetParameterAsText(0)
field = arcpy.GetParameterAsText(1)
env.workspace = arcpy.GetParameterAsText(2)
# create search cursor
rows = arcpy.SearchCursor(in_fc)
for row in rows:
where_clause = field + “='” + row.getValue(field) + “‘”
# name the output features based on the value found in the field selected above
analysis.Select(in_fc, row.getValue(field), where_clause)
This script is set up to be added to a toolbox in ArcGIS 10. I set up the script tool parameters as shown in the dialog box below. When you select the second parameter, the field based upon which the new features should be named, in the lower part of the dialog box click next to “Obtained from” and select the input feature class parameter.