I have a schools shapefile with different facilities. I created a search cursor to only select records where the field "name" is equal to high school. Then I was to use a for loop to print out all the names of the different high schools. I managed to complete this successfully;however, I must also print out the no. of high schools that I just queried in the search cursor. So for instance I managed to use the search cursor to print out 35 high schools (or atleast their names). How would I use the search cursor to print out the no. of records or no. of highschools that I have just printed out. I can't use the selectlayer only search cursor. Here's my code below.
#import arcpy module
import arcpy
from arcpy import env
arcpy.env.overwriteOutput = True
# I am setting the work path
env = 'S:\\376\\Summer15-2\\ahutche1\\lab07_data\\SectionB\\'
#I will set the variable for the schools shapefile
schools = 'Schools'
#create search cursor to loop thru schools. use where clause to return schools
#that are high schools. Use loops
#print out all the highschool names
#print total no. of high school records
sr = arcpy.SpatialReference(4326)
#I will create a search cursor for the schools shapefile
field = "NAME"
exp1 = '"FACILITY" = \'HIGH SCHOOL\''
cursor = arcpy.SearchCursor(env+schools+'.shp',exp1)
#I have now printed out all of the names of the facilities that are high schools
for row in cursor:
print(row.getValue(field))
#this code above was successful
#I am attempting to print out the number of facilities that are highschools but this is wrong because it prints out the total no. of records and not the ones I queried above.
#while cursor:
#count = arcpy.GetCount_management(env+schools+'.shp')
#result = int(count.getOutput(0))
#print result
#break