[GIS] Deleting row with cursor in ArcPy

arcpycursor

I am trying to delete field names where the field "FULL_NAME" = 1.

What am I doing wrong here?

I am not getting an error message, but nothing is being deleted from my file. I am not sure why the delete field isn't working.

import arcpy
roads = "C:/hwy"
cursor = arcpy.da.UpdateCursor(roads, ["FULL_NAME"]) 
for row in cursor:
    row[0] == "1":  
        cursor.deleteRow()
del row
del cursor

Best Answer

Instead of:

    row[0] == "1":  
        cursor.deleteRow()

try this:

    if row[0] == "1":  
        cursor.deleteRow()
Related Question