I have some shapefiles and each shapefile is having some blank or zero value fields. My task is to delete blank/zero value fields for all shapefiles in the folder. I have searched for solution in this site and found one Python program but unfortunately I am not successful with available Python program. Below is the my code and I don't know where I made a mistake.
I have attached image also for reference and the fields i wanted to delete are shown with line
After running code, I did not encounter any error message but fields are not removed
Empty field deleted
import os import arcpy from arcpy import env path = r"C:\SOFTWARE\Shapefiles\test" env.workspace = path fcs = arcpy.ListFeatureClasses() # Iterate over the feature classes for fc in fcs: # Test whether the field is required--rather than testing the field type fieldList = arcpy.arcpy.ListFields(fc) # Iterate over the fields for field in fieldList: # Set a test variable to False with arcpy.da.SearchCursor(fc, field.name) as cursor: for row in cursor:`enter code here` if field == " " or field == 0: arcpy.DeleteField_management(fc, field.name) print ("Empty field deleted")