HOW TO
The SearchCursor function is useful to extract values from a feature class or an attribute table including null values. By using a Python expression, this function lists all null values of a selected field.
The article describes how to search for null values in an attribute table using the SearchCursor function in ArcGIS Pro.
import arcpy sql = "<fieldName> IS NULL"
fc = r"<pathName>"
cursor = arcpy.da.SearchCursor (fc, ["OBJECTID"], where_clause=sql )
for row in cursor:
print(row[0])
The code block below demonstrates an example of the full working script.
import arcpy
sql = "FacilityID IS NULL" fc = r"C:\Users\Documents\ArcGIS\Projects\MyProject22\MyProject22.gdb\Point1" cursor = arcpy.da.SearchCursor (fc, ["OBJECTID"], where_clause=sql ) for row in cursor:
print(row[0])
The image below shows the ObjectIDs of the null values are printed in the Python window.
Get help from ArcGIS experts
Download the Esri Support App