I am trying to cursor search through some records in an access table from a field called DEV_TYPE. I want to compare each record against a list of know values I have built earlier in my script:
(devcatList)
I want to print out any values that do not occur in the list. Some of the values in the records are Null as well. I want to set my if statement to only print out values that do not occur in the list, but I also do not want to print out ‘None’ for the Null values. My script is as follows:
if field.name == "DEV_TYPE":
for iRow in arcpy.SearchCursor(fc):
if not iRow.DEV_TYPE is None or iRow.DEV_TYPE not in devcatList:
print str(iRow.OBJECTID) + " - " + str(iRow.DEV_TYPE)
I’ve played around with the ‘if not x is None‘ to ‘if x is not None‘. Changed the ‘or‘ to and ‘and‘ (even though it was counter intuitive), but my printouts either return all values or no values or only ‘None‘….basically everything I don’t want. I’m sure I’m doing something silly. Can someone point out what my silliness is?
Thanks,
Mike
I think you want
if iRow.DEV_TYPE is not None and iRow.DEV_TYPE not in devcatList: