浮动对象的麻烦

时间:2016-05-29 22:15:53

标签: python cursor arcpy

我正在尝试将数据列表附加到属性表中,但我不断收到相同的错误

for field in fields:
arcpy.AddField_management(equal_shape, field[0], field[1])
print "step 3"

total_area = []
with arcpy.da.SearchCursor(equal_shape, ("OID@", "SHAPE@AREA")) as cursor:
    for row in cursor:
        print("Feature {0} has an area of {1}".format(row[0], row[1]))
print "step 4"

sum_area = sum(total_area)
with arcpy.da.UpdateCursor(equal_shape, ["TOT_AREA"]) as cursor:
    for row in cursor:
        row[0] = total_area
        cursor.updateRow(row)

以下是我收到的错误:

 sum_area = sum(total_area)
TypeError: 'float' object is not iterable

0 个答案:

没有答案