Sorry, my test was on strings. I did not include functionality for other types. Try this:import arcpy from os import path as p arcpy.overwriteOutput = True fc = r'F:\shape_clean_python\rioDej_fav.shp' field = 'FID' outws = r'F:\shape_clean_python\exports' valList = [] with arcpy.da.SearchCursor(fc,[field]) as rows: for row in rows: value = row[0] if value not in valList: valList.append(value) for val in valList: for fld in arcpy.ListFields(fc): if fld.name == field: if fld.type == 'String': query = '"{0}" = \'{1}\''.format(field,val) else: query = '"{0}" = {1}'.format(field,val) output = p.join(outws,str(val).replace(' ','_')) desc = arcpy.Describe(outws) if desc.workspaceType == 'FileSystem': output += '.shp' if arcpy.Exists(output): arcpy.Delete_management(output) arcpy.Select_analysis(fc, output, query) print 'Created "%s"' %p.basename(output)