I'm trying to print the field name to a list if all rows in that field are not NULL. Here is the logic I have so far.
fiberCable = r'Orlando\Orlando_FIM_prep\FIBERCABLE' list = [] with arcpy.da.SearchCursor(fiberCable, "inventory_status_code") as cursor: for row in cursor: if row[0] is not None: list.append(str(row[0]))
Using the logic on the table above it prints out this list:
['Preliminary Designed', 'DesignComplete', 'DesignComplete', 'DesignComplete', 'DesignComplete']
How do I get the search cursor to look at the row of values in the field and if there is a value present in all rows, print the field name, which in this case would be 'inventory_status_code'.
The outcome I would be looking for here is:
['inventory_status_code']
Best Answer
The most efficient way to do it (i.e., not reading every single row in the table) is to do this...see the comments for explanation:
Assuming that you want to do this for multiple fields:
By the way, never ever ever use a python keyword of any kind as a variable name (e.g., list)