Python を使用して、ArcMap (10.1) で実行されるスクリプトを作成する方法を学んでいます。以下のコードでは、シェープファイルが配置されているフォルダーをユーザーが選択し、シェープファイルを調べて、「landuse」で始まるシェープファイルのみの値テーブルを作成します。
値が引数で選択されており、フォルダーをコードに直接配置できないため、値テーブルに行を追加する方法がわかりません。以下のコードを参照してください...
#imports
import sys, os, arcpy
#arguments
arcpy.env.workspace = sys.argv[1] #workspace where shapefiles are located
#populate a list of feature classes that are in the workspace
fcs = arcpy.ListFeatureClasses()
#create an ArcGIS desktop ValueTable to hold names of all input shapefiles
#one column to hold feature names
vtab = arcpy.ValueTable(1)
#create for loop to check for each feature class in feature class list
for fc in fcs:
#check the first 7 characters of feature class name == landuse
first7 = str(fc[:7])
if first7 == "landuse":
vtab.addRow() #****THIS LINE**** vtab.addRow(??)