subtypes = arcpy.ListSubtypes(table_name) 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]))
Solved! Go to Solution.
I am following ESRI Documentation link (ListSubtypes) to print the details of subtype associated with a feature class but for some reason am always getting an error message complaining arcpy doesn't contain a definition for ListSubtypes(table_name) method.
subtypes = arcpy.ListSubtypes(table_name)
Secondly, I was wondering if there is anyway we can get a subtype values instead of codes.
I am following ESRI Documentation link (ListSubtypes) to print the details of subtype associated with a feature class but for some reason am always getting an error message complaining arcpy doesn't contain a definition for ListSubtypes(table_name) method.
subtypes = arcpy.ListSubtypes(table_name)
Secondly, I was wondering if there is anyway we can get a subtype values instead of codes.
Britt, this method is within the arcpy.da module. The code example is a bit weak in the help; I complained in the feedback - and I suggest you do too!
Have you tried:
subtypes = arcpy.da.ListSubtypes(table_name)
I'm pretty sure the most direct approach would be to examine the associated domain with arcpy.da.ListDomains.