import arcpy
... from arcpy import env
... env.workspace = "F:\\1project\\beibuwan\\data\\tdlxsg\\un2000\\"
... shps= arcpy.ListFeatureClasses()
... for shp in shps:
... print shp
... arcpy.AddField_management(shp, "area", "DOUBLE")
#要注意层级关系,用TAb空行
批量添加字段,在excel里输入字段名,类型,长度等信息,另存为txt,将空格改为逗号,逗号一定要是英文,双精度的精度要大于6,多打一个逗号可以在最后一个字段处不用去掉换行符
import arcpy
f=open("C:/Users/haiju/Desktop/FIE.txt","r")
... line=f.readline()
...
... while line:
... lineList=line.split(',')
... arcpy.AddField_management("New_Shapefile",field_name=lineList[0],field_type=lineList[1],field_length=lineList[2],field_precision=lineList[3],field_scale=lineList[4])
... line=f.readline()