AnsweredAssumed Answered

GetCount_management & InsertCursor

Question asked by LarryAdgate on Jan 22, 2018
Latest reply on Jan 23, 2018 by csgeosol1


#This scrip is working to a point, but is not what I expected. If Someone could help me with this,
#it would be greatly appricated.......Thank You in advance.

 

#The GetCount_management "COUNT" for the wHydrant Feature Class is 4457.
#After running the script, the result is four separtate rows in one column. See attached.
#My expectation is only one row and one column.

 

import arcpy

lyrfile ="C:\\Projects\\DavidSchultise_Southwest_GIs\\SouthwestTesting.gdb\\HydrantTesting\\wHydrant"
result = arcpy.GetCount_management(lyrfile)
print('{} has {} records'.format(lyrfile, result[0]))


#My Table
fc ="C:\\Projects\\DavidSchultise_Southwest_GIs\\Testing.dbf"

for row in (result[0]):
cursor = arcpy.da.InsertCursor(fc, ["NUMBER"])
cursor.insertRow(row[0])

Attachments

Outcomes