Hello all,
I am new to Python and, as you can probably guess, I am having issue with some code I'm attempting to write. The following will describe what I am attempting to do, and hopefully you wonderful people can tell me what I'm doing wrong.
I have a point feature class with an attribute field called "STOINLET_I." The field looks like this, and has about 2000 entries (rows):
PDIN-0001
PDIN-0002
PDIN-0003
PDIN-0004
...
Here is a screenshot, to help better articulate the feature class:
Attachment 26495
What I am attempting to do with this script is remove the first character in every row of the field so that the "P" no longer exists, which would leave me with this:
DIN-0001
DIN-0002
DIN-0003
DIN-0004
...
I am confident that the first section of code runs successfully. The problem lies within the cursor, but I cannot figure out where. I know this should be easy, but any help would be sincerely appreciated!
I am new to Python and, as you can probably guess, I am having issue with some code I'm attempting to write. The following will describe what I am attempting to do, and hopefully you wonderful people can tell me what I'm doing wrong.
I have a point feature class with an attribute field called "STOINLET_I." The field looks like this, and has about 2000 entries (rows):
PDIN-0001
PDIN-0002
PDIN-0003
PDIN-0004
...
Here is a screenshot, to help better articulate the feature class:
Attachment 26495
What I am attempting to do with this script is remove the first character in every row of the field so that the "P" no longer exists, which would leave me with this:
DIN-0001
DIN-0002
DIN-0003
DIN-0004
...
I am confident that the first section of code runs successfully. The problem lies within the cursor, but I cannot figure out where. I know this should be easy, but any help would be sincerely appreciated!
Code:
import arcpy, string, os, fileinput
from arcpy import env
env.workspace = "desired workspace"
env.overwriteOutput = True
fc = "desired feature class"
verification = arcpy.Exists (fc)
print verification
del verification
cursor = arcpy.da.UpdateCursor (fc, ["STOINLET_I"])
for row in cursor:
row.Replace(row[0:],'')
del row
del cursor