cursor.updateRow([row])报错

import string

def CoderVector(layer,assetClassCode):

    cursor=arcpy.da.UpdateCursor(layer,["FID","ASSETCODE"]);
    for row in cursor:
        row[1]=str(row[0]+assetClassCode)
        cursor.updateRow([row])
    del row
    del cursor

def SetASSETCODE(layer):
    
    assetcode=0
    if layer.name.encode("utf-8")=='标线':
        assetClassCode=2200700000000
        CoderVector(layer,assetClassCode)

try:
    mxd = arcpy.mapping.MapDocument("CURRENT")
    for lyr in arcpy.mapping.ListLayers(mxd):
       SetASSETCODE(lyr)
except Exception as e:
    print e.message
 
上面加粗倾斜的行报错,错误提示:
sequence size must match size of the row
我的 ASSETCODE 字段类型是 text 在网上查了一下 有的说是因为 string 类型插入text字段不支持;不知道如何解决,请高手指教。
 
A10.jpg a8.jpg a9.jpg
已邀请:

细风

赞同来自:

我只是想修改这个字段的值,上面的方法可能不是个好方法
有其他的方法,也欢迎高手提示一下。

GADFLY

赞同来自:

cursor.updateRow(row)
我也遇到这个问题了,这样tia调整就行了。
谢谢jia江老师

要回复问题请先登录注册