Résumé
The Describe function returns the following properties for all Describe objects.
Propriétés
Propriété | Explication | Type de données |
baseName (Lecture seule) | The file base name | String |
catalogPath (Lecture seule) | The path of the data | String |
children (Lecture seule) | A list of sub elements | Describe |
childrenExpanded (Lecture seule) | Indicates whether the children have been expanded | Boolean |
dataElementType (Lecture seule) | The element type of the element | String |
dataType (Lecture seule) | The type of the element | String |
extension (Lecture seule) | The file extension | String |
file (Lecture seule) | The file name | String |
fullPropsRetrieved (Lecture seule) | Indicates whether full properties have been retrieved | Boolean |
metadataRetrieved (Lecture seule) | Indicates whether the metadata has been retrieved | Boolean |
name (Lecture seule) | The user-assigned name for the element | String |
path (Lecture seule) | The file path | String |
Exemple de code
Display some Describe object properties for a file geodatabase.
import arcpy
# Create a Describe object
#
desc = arcpy.Describe("C:/Data/chesapeake.gdb")
# Print some Describe Object properties
#
if hasattr(desc, "name"):
print("Name: " + desc.name)
if hasattr(desc, "dataType"):
print("DataType: " + desc.dataType)
if hasattr(desc, "catalogPath"):
print("CatalogPath: " + desc.catalogPath)
# Examine children and print their name and dataType
#
print("Children:")
for child in desc.children:
print("\t%s = %s" % (child.name, child.dataType))
Vous avez un commentaire à formuler concernant cette rubrique ?