I am using ArcMap 10.6.1.
I'm trying to write a script that relates data from a .csv file to a utility pole shape file. Basically, we want the script to iterate through the pole # fields in each table and determine which pole numbers are missing from the .shp. Right now, the script iterates through every row of the field and appears to not be reading the pole # value inputted by the user, since every print out reads the pole # and NO (ex: 111A0111, NO) no matter if the pole # is matching or not. We want the program to read "YES" if the pole number is in both tables, and "NO" if it is only in the .csv file and not the .shp.
import arcpy import csv #define other variable fc = "P:\Scripts\data_check\prd_poles.shp" field = "GISID" #Create a list to be populated by the search shapefile search cursor gis_poles_assets = cursor = arcpy.SearchCursor(fc) #Populate the list for row in cursor: gis_poles_assets.append(row.getValue(field)) #print gis_poles_assets #define the csv to be read by the reader and make that a variable f = open(r'P:\Scripts\data_check\discoverer_poles_snip.csv') csv_f = csv.reader(f) #search the shapefile based on fields in a .csv for row in csv_f: if row  in gis_poles_assets: pass elif "111A0111" in gis_poles_assets: print row , "YES" else: print row , "NO"