Working with the ArcPy list functions
Getting a list of data is often the first step in a multistep geoprocessing operation. ArcPy provides many list functions that you can use to gather lists of information, whether they are feature classes, tables, workspaces, and so on. After gathering a list of data, you will often perform geoprocessing operations against the items in the list. For example, you might want to add a new field to all the feature classes in a file geodatabase. To do this, you'd first need to get a list of all the feature classes in the workspace. In this recipe, you'll learn how to use the list functions in ArcPy by working with the ListFeatureClasses()
function. All the ArcPy list functions work in the same fashion.
Getting ready
ArcPy provides functions to get lists of fields, indexes, datasets, feature classes, files, rasters, tables, and more. All the list functions perform the same type of basic operations. The ListFeatureClasses()
function can be used to generate a list...