Trying to format a field but I am not sure how accomplish it. The trouble I am having is the making the second to last 0 a space but only if there is no alph char. WellPin field is always 10 numbers and sometimes with an alph char. Can someone help me out by showing me how to do this with updatecurosr and in a filed calculator please?
Well WPin
W1234500000 --> 12345000 0
W1234501000--> 12345010 0
W12345010S0--> 12345010S0
W12345010S1--> 12345010S1
Here what I have so far.
import arcpy
arcpy.env.overwriteOutput = True
fc = r"C:\Temp\Wells.shp"
count = 0
def maketv_cursor(fc):
rows = arcpy.SearchCursor(table,"WPin")
count = 0
for row in rows:
count += 1
#print(count)
with arcpy.da.UpdateCursor(fc,['WellID','WPin']) as cursor:
for row in cursor: #if row[0] in (None, "", " "):
row [1] = (row[0][1:11]) # Field Calculator!WellID! [1:11]
cursor.updateRow(row)<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>