ListEnvironments

Summary

The ListEnvironments function returns a Python list of geoprocessing environment names.

Syntax

ListEnvironments ({wild_card})
ParameterExplanationData Type
wild_card

The wild card limits the results returned. If no wild card is specified, all values are returned.

# A wild_card of "*workspace" will return a list including the 
#   workspace and scratchWorkspace environment names
arcpy.ListEnvironments("*workspace")
String
Return Value
Data TypeExplanation
String

The Python List returned from the function containing the geoprocessing environment variable names, optionally limited by a wild card filter.

Code Sample

ListEnvironments example

Lists the environment variable name and current value.

import arcpy
from arcpy import env

environments = arcpy.ListEnvironments()

for environment in environments:
    # As the environment is passed as a variable, use Python's getattr function 
    #   to evaluate the environment's value
    #
    envSetting = getattr(env, environment)

    # Format and print each environment and its current setting
    #
    print "%-28s: %s" % (environment, envSetting)

Related Topics


10/28/2011