I have a shapefile with an attribute table similar to the one below.
First, I want to search for any rows where 'NAME' starts with '***'. Then, from that selection I want to print out data if the 'DOG' column is not <Null>.
Using the table above the output should look like this.
Here is my code so far
def findAnimal(shapefilePath): fields = ('NAME','CAT','DOG') cursor = arcpy.da.UpdateCursor(sp,fields) for row in cursor: nameStr = row if nameStr[0:3] == "***": if row != None: print row print row cursor.updateRow(row)
This is what my code is currently printing out.
There is blank row after '***Pat' ,so it looks like it is printing out the <Null> value.
It appears that Line 07 in my code is not working.