# Import native arcgisscripting module
import arcgisscripting, sys
# Create the geoprocessor object
gp = arcgisscripting.create(9.3)
# Table and field name inputs
inTable = sys.argv[1]
inField = sys.argv[2]
rows = gp.SearchCursor(inTable)
row = rows.Next()
# Create an empty list
uniqueList = []
while row:
# If the value is not already in the list, append it
if row.GetValue(inField) not in uniqueList:
uniqueList.append(row.GetValue(inField))
row = rows.Next()
# Sort the list alphanumerically
uniqueList.sort()
print uniqueList
分类: Python
原文地址:https://www.cnblogs.com/gisoracle/p/10848289.html
时间: 2024-10-09 14:14:38