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字段不支持;不知道如何解决,请高手指教。
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字段不支持;不知道如何解决,请高手指教。
2 个回复
细风
赞同来自:
有其他的方法,也欢迎高手提示一下。
GADFLY
赞同来自:
我也遇到这个问题了,这样tia调整就行了。
谢谢jia江老师
要回复问题请先登录或注册
发起人
相关问题
问题状态
—— 扫技术支持中心微信服务号!
—— 让GIS知乎问答随时随地!