[GIS] Create Python Dictionary from feature classes, fields, and domains

arcpydictionaryfeature-class

I want to create a Python dictionary with a Feature class as the key and the fields of the feature class and domains of the feature class as separate values. I'm starting off by simply attempting to add a Feature class (as a key) and its respective feature types(as values) but I'm not sure how to build that out. here's what I am trying to do by using list comprehension but my dictionary is empty:

    Dict = {fc.name: fc.featureType.values()for fc in arcpy.ListFeatureClasses(r"gdb")}

    print Dict

Any clues on how I can start this off?

Best Answer

As an alternative to list comprehension, and to try and learn more about using dictionaries with ArcPy I think you should start with an empty dictionary and then use Describe to determine and add the values as you iterate ListFeatureClasses.

Related Question