Solved! Go to Solution.
After I export my data to a shapefile, I have a range of addresses for which I need to replace their suffixes from Dr to Ave. I'm using a process I developed in Model Builder to perform the export. Is there a way to script the edit, and integrate it into my process model? Thanks.
After I export my data to a shapefile, I have a range of addresses for which I need to replace their suffixes from Dr to Ave. I'm using a process I developed in Model Builder to perform the export. Is there a way to script the edit, and integrate it into my process model? Thanks.
import arcpy
import os
import string
import re
arcpy.env.workspace = r'C:\Workspace\PARCELIDCLEANUP.gdb'
fcs = arcpy.ListFeatureClasses()
# Create list of fields for keeping
s = ['PARCELNO']
for fc in fcs:
print "** Now working on "+fc
fields = arcpy.ListFields(fc)
for field in fields:
if field.baseName in s:
rows = arcpy.UpdateCursor(fc)
for row in rows:
targetRow = row.PARCELNO
row.PARCELNO = targetRow.replace(' ','')
row.PARCELNO = targetRow.replace('-','')
rows.updateRow(row)
del row
del rows
print " Parcelno cleaned"
if not field.baseName in s:
None
print "PARCELNO is edited"
Thanks for your help. I was able to build the process in Model Builder and integrate it with my data export model.