ListSubtypes (arcpy.da)

サマリ

Returns a dictionary of the subtypes for a table or feature class.

構文

ListSubtypes (table)
パラメータ説明データ タイプ
table

The geodatabase table or feature class.

String
戻り値
データ タイプ説明
Dictionary

Returns a dictionary of subtype properties. The keys of the dictionary are the subtype codes, and the values of the dictionary are the subtype properties.

コードのサンプル

ListSubtypes example 1

List all the subtypes for a feature class and print out the properties for each one.

import arcpy

subtypes = arcpy.da.ListSubtypes('C:/data/Boston.gdb/Boundary')

for stcode, stdict in subtypes.iteritems():
    print('Code: {0}'.format(stcode))
    for stkey in stdict.iterkeys():
        if stkey == 'FieldValues':
            print('Fields:')
            fields = stdict[stkey]
            for field, fieldvals in fields.iteritems():                
                print(' --Field name: {0}'.format(field))
                print(' --Field default value: {0}'.format(fieldvals[0]))
                if not fieldvals[1] is None:
                    print(' --Domain name: {0}'.format(fieldvals[1].name))
        else:                    
            print('{0}: {1}'.format(stkey, stdict[stkey]))

関連トピック

4/26/2014