this is a novice question
I have an attribute field that's missing a piece of information, i'd like to amend the attribute field like below:
This is the current attribute field:
"V:\Building & Development...."
and i'd like to add "\Engineering" to attribute field
"V:\Engineering\Building & Development...."
I have to make this change to 1441 attribute fields, not sure how to write the python script in the field calculator. I'm doing this on ArcGIS 10.2 for Desktop
1 Answer 1
Using the Python parser in the field calculator:
Pre-logic script code:
def convert(x):
a = x.split(":")
return a[0] + ":\Engineering" + a[1]
convert(!text_field!)
You can also use an UpdateCursor to do this
import arcpy
fc = r'path\to\your\fc'
with arcpy.da.UpdateCursor(fc, "your_field") as cursor:
for row in cursor:
if row[0] != None:
a = row[0].split(":")
row[0] = a[0] + ":\Engineering" + a[1]
cursor.updateRow(row)
Explore related questions
See similar questions with these tags.