I'm running ArcGIS 10.3 and have a geodatabase with multiple feature datasets each containing multiple feature classes. Each feature class has multiple string type fields containing <Null> values. I want to change the <Null> values to "TBD" (without the quotation marks).
I feel I'm very close, but at 'for row in cursor:' I'm receiving the error "Too few parameters. Expected 1." I guess the cursor isn't actually returning any rows at all? Below is what I currently have; I haven't added any documentation or messaging yet. Any help would be greatly appreciated.
import arcpy from arcpy import env import os #Set variables inputgdb = sys.argv[1] nullCount = 0 #Set workspace arcpy.env.workspace = inputgdb #Populate Nulls with TBD datasetList = arcpy.ListDatasets(feature_type = 'feature') datasetList = [''] + datasetList if datasetList is not None else [] for dataset in datasetList: env.workspace = inputgdb + "\\" + dataset dataset = dataset + "\\" fcList = arcpy.ListFeatureClasses() for fc in fcList: fc = fc +"\\" fieldList = arcpy.ListFields(fc,["String"]) for field in fieldList: with arcpy.da.UpdateCursor (fc, 'fieldList') as cursor: for row in cursor: if row[0] == None: row[0] = 'TBD' cursor.updateRow(row)
Solved! Go to Solution.
Just for future reference, you can format your code with syntax highlighting so it looks like it does in the IDE and is easier to read.
Thanks Blake - applied to original post. Working through the other suggestions/help now. Much appreciated.