AnsweredAssumed Answered

Remove features/rows that start with

Question asked by CCweedcontrol on Apr 20, 2018
Latest reply on Apr 24, 2018 by CCweedcontrol

I have some rows that i would like to remove if they start with certain letters. I have the following code but i have to run it twice in order for it to remove certain rows, i am not sure why? I want to be able to remove rows that have the following in them "Xit",UPRR""Inpr Mp", "Impr Rxr", "I 84". How can i do this?

 

#delete all attributes/Rows that start with Xit, UPRR,Inpr Mp, Impr Rxr, I 84
with arcpy.da.UpdateCursor(lyr, 'STREET') as cursor:
    for row in cursor:
        if row[0].startswith("Xit"): #"UPRR","Inpr Mp", "Impr, "Rxr", "I 84"
            cursor.deleteRow()

Outcomes