ListDomains (arcpy.da)

Zusammenfassung

Lists the attribute domains belonging to a geodatabase.

Syntax

ListDomains (workspace)
ParameterErläuterungDatentyp
workspace

A geodatabase.

String
Rückgabewert
DatentypErläuterung
Domain

A Python list containing domain objects. Each domain object contains properties to get domain information.

Codebeispiel

ListDomains example 1

List and describe all the workspace domains.

import arcpy

domains = arcpy.da.ListDomains("C:/Boston/Boston.gdb")

for domain in domains:
    print('Domain name: {0}'.format(domain.name))
    if domain.domainType == 'CodedValue':
        coded_values = domain.codedValues
        for val, desc in coded_values.iteritems():
            print('{0} : {1}'.format(val, desc))
    elif domain.domainType == 'Range':
        print('Min: {0}'.format(domain.range[0]))
        print('Max: {0}'.format(domain.range[1]))

Verwandte Themen

9/11/2013