GetParameter (arcpy)

Resumen

From the parameter list, select the desired parameter by its index value. The parameter is returned as an object.

Debate

To use the parameter as a text string instead, see GetParameterAsText.

Sintaxis

GetParameter (index)
ParámetroExplicaciónTipo de datos
index

Selects the specified parameter, by its index, from the parameter list.

Integer
Valor de retorno
Tipo de datosExplicación
Object

Object is returned from specified parameter.

Ejemplo de código

GetParameter example

Get script tool parameter as object.

import arcpy

# Get the spatial reference from the tool dialog.
#
SR = arcpy.GetParameter(0)

# Display the Spatial Reference properties
#
arcpy.AddMessage(SR.name)
arcpy.AddMessage(SR.type)
arcpy.AddMessage(SR.factoryCode)

Temas relacionados

9/11/2013