以下に、テーブルをループして特定の列内の値を出力するPythonコードがあります。表示されていないのは、ユーザーがフィーチャレイヤーを選択するフォームです。機能レイヤーが選択されると、2番目のドロップダウンにその機能のすべての列見出しが表示され、ユーザーはフォーカスする列を選択します。Pythonスクリプト内で、その列内の各値を出力するだけです。しかし、各値をリストまたは配列に格納して、個別の値を取得したいと思います。Pythonでこれを行うにはどうすればよいですか?
また、行ごとに移動するよりも、テーブルをループするより効率的な方法はありますか?それはどういうわけか非常に遅いです。
どうもありがとう
# Import system modules
import sys, string, os, arcgisscripting
# Create the Geoprocessor object
gp = arcgisscripting.create(9.3)
gp.AddToolbox("E:/Program Files (x86)/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx")
# Declare our user input args
input_dataset = sys.argv[1] #This is the Feature Layer the User wants to Query against
Atts = sys.argv[2] #This is the Column Name The User Selected
#Lets Loop through the rows to get values from a particular column
fc = input_dataset
gp.AddMessage(Atts)
rows = gp.searchcursor(fc)
row = rows.next()
NewList = []
for row in gp.SearchCursor(fc):
##grab field values
fcValue = fields.getvalue(Atts)
NewList.add(fcValue)