I am writing my very first script in Python 2.7. (And this is my very first question/post here and about Python scripting at all)
Solved/found out almost all problems except one.
I can not figure out how to write this following for arcpy.da.UpdateCursor:
if row[0] is equal row[1] then row[2] is None
Any suggestion is appreciated.
I am excpecting a relevant answer to my question.
Here is the correct code and a solution for my question.
import arcpy
fc = 'C:/DB/PGDB.gdb/Parcel_point.shp'
fields = ['NEWNUMBER', 'NEWNUMBER1', 'NEWNUMBER2']
with arcpy.da.UpdateCursor(fc, fields) as cursor:
for row in cursor:
if (row[0] == row[1]):
row[2] = None
cursor.updateRow(row)
del cursor
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.