使用Python将表的行单元格替换为另一个表的行单元格

时间:2019-03-22 02:21:35

标签: python excel row cell

在Python中,我正在尝试...

查看2个单元格 一排桌子

,然后查看2个单元格 一排第二张桌子

,然后,如果[Table1.RowCell1]的值等于[Table2.RowCell1]的值, 用[Table1.RowCell2]填充[Table2.RowCell2]

类似这样的代码是什么样的? 是否需要嵌套for循环?

这是我现在拥有的代码:

with arcpy.da.SearchCursor(sj, ["TARGET_FID", field2]) as scursor:
    for srow in scursor:
        with arcpy.da.UpdateCursor(fl, ["OBJECTID", field]) as ucursor:
            for urow in ucursor:
                if srow[0] == urow[0]:
                    arcpy.AddWarning("You updated FID:" + str(srow[0]))
                    urow[1] = srow[1]
                    ucursor.updateRow(urow)
                    count = count + 1

这种逻辑有意义吗?

0 个答案:

没有答案