Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a geodatabase with many feature classes. Some of the feature classes have subtype fields. Their names vary feature class by feature class. I now want to find the names of those subtype fields. What I have so far is:

for fc in arcpy.ListFeatureClasses("*","",dataset):
    subtypefields = arcpy.da.ListSubtypes(fc)
    for subtype in subtypefields:

Now, I don't know how to continue from here. Any help will be appreciated. Thanks!

share|improve this question
up vote 7 down vote accepted

There is a good example in the documentation. Adapted for your purposes:

for fc in arcpy.ListFeatureClasses("*","",dataset):
    subtypes = arcpy.da.ListSubtypes(fc)
    for stcode, stdict in subtypes.iteritems():
        print('Code: {0}'.format(stcode))
        for stkey in stdict.iterkeys():
            if stkey == 'FieldValues':
                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))
                print('{0}: {1}'.format(stkey, stdict[stkey]))
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.