import arcpy
...
... rows = arcpy.UpdateCursor("河道面_split_attributes","","","","sectionN A")
...
... i=1
...
... for row in rows:
...
... row.num=i
...
... i=i+1
...
... rows.updateRow(row)
...
... del rows
...
... del row
import arcpy
cur=arcpy.UpdateCursor("河道面_split_attributes","","","","sectionN A")
...
... i=0
...
... for row in cur:
...
... row.num=i
...
... cur.updateRow(row)
...
... del cur,row
...
... print "success"
...
在ArcGIS属性表中根据某一字段进行分组编号
rec=0
fname = ""
def autoIncrement(field):
global rec
global fname
if field != fname:
fname = field
pStart = 1 #adjust start value, if req'd
rec = pStart
return rec
else:
pInterval = 1 #adjust interval value, if req'd
rec = rec + pInterval
return rec
autoIncrement(!RiverName!)
在ArcGIS属性表中对字段重新编号
star= 0
def num():
global star
star+=1
return star
(str(num())).zfill(3)