以下是我的python脚本的一部分:
gp.CalculateField_management("parcs", "Apn", "[oldApnfield]")
问题是我计算的字段将在每个shapefile中被命名为不同的字段,因此我不能在计算中使用字段名称。是否有python用于标识字段的内部ID?说“数据库中的第一个字段”而不是使用字段名称的python语言是什么?
感谢您的帮助。我非常接近,但现在计算结果是新字段中的每一行都是PIDNUM而不是PIDNUM的值......
import arcgisscripting
# Create the geoprocessor object
gp = arcgisscripting.create(9.3)
gp.OverWriteOutput = True
# Set the workspace. List all of the folders within
gp.Workspace = "C:\ZP44"
fcs = gp.ListWorkspaces("*","Folder")
#
for fc in fcs:
print fc
gp.MakeFeatureLayer(fc + "\\Parcels.shp", "parcs")
fieldList = gp.ListFields("parcs")
print fieldList[2].Name
field1 = fieldList[2].Name
print field1
gp.CalculateField_management("parcs", "Apn", "[field1]")