I want to run a python code that, if 4 fields are empty, insert in the first of them a text. The fields are all designed to contain text. My code is:
import arcpy
import xlrd
import numpy
import pdb
arcpy.env.workspace = r"Directory"
arcpy.env.overwriteOutput = True
shape = r"C:\Directory\Shapefiles.shp"
fields = ['A', 'B', 'C', 'D']
cursor = arcpy.da.UpdateCursor(shape,fields)
for row in cursor:
if row[0] == None:
if row[1]== None:
if row[2]== None:
if row[3]== None:
row[0] = 'Not_Officially_Recorded'
cursor.updateRow(row)
arcpy.FeatureClassToShapefile_conversion(shape, r'Anotherdirectory')
print('Done')
Anyway, the code runs suspiciously quickly and after I look at it, I see that nothing has been done. So what may the error be?