Example: Listing Feature Classes in a Workspace
from arcpy import env
# Set the workspace. List all of the feature classes that start with 'G'
env.workspace = r"c:\temp\data.gdb"
fcs = arcpy.ListFeatureClasses("G*")
The results of this is a list of feature classes in the env.workspace path. The variable fcs is an array of paths to each feature class begining with the letter G.
Example: Using List Results
# Set the workspace. List all of the TIFF files
# Gets a list of raster data (TIF)
for tiff in arcpy.ListRasters("*", "TIF"):
Here we can a simple process that takes the list data and prints the results back to the user. The only returned results are of type Tagged Image File Format. If no images of that file type are found, then an empty array is returned.
List Function Type Keywords
The keywords for the list functions return what is returned to the user in the list. Here is the list of key words as found in the ArcGIS 10 help documentation: