frequency of values in a field

Andreas Tawn andreas.tawn at ubisoft.com
Wed Feb 9 20:10:45 CET 2011


> How do you add all the records in the particular field of interest
> into long_list?

>From earlier in the thread you did...

import arcgisscripting
# Create the geoprocessor object
gp = arcgisscripting.create()
records_list = []
cur = gp.SearchCursor(dbfTable)
row = cur.Next()
while row:
   value = row.particular_field
   records_list.append(value)

I'd rewrite that as...

import arcgisscripting
gp = arcgisscripting.create()
cur = gp.SearchCursor(dbfTable)
records_list = [row.particular_field for row in cur]
# I've no experience of arcgis,
# so I'm assuming that SearchCursor is an iterable of some sort

Cheers,

Drea



More information about the Python-list mailing list