ListEnvironments (arcpy)

Summary

The ListEnvironments function returns a 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.

import arcpy

# 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 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

environments = arcpy.ListEnvironments()

# Sort the environment names
environments.sort()

for environment in environments:
    # Format and print each environment and its current setting.
    # (The environments are accessed by key from arcpy.env.)
    print("{0:<30}: {1}".format(environment, arcpy.env[environment]))

Related Topics

3/3/2014