0 Replies Latest reply on Feb 9, 2017 2:49 PM by Josh Pritt

    How-to: Sort GDB Domains with Python

    Josh Pritt

      Here's a quick script for grabbing the list of domains from a database and sorting them by name:


      import arcpy
      domains = arcpy.da.ListDomains("C:/YourGeodatabase.gdb")
      sortedDomains = sorted(domains, key=lambda domain: domain.name)
      for domain in sortedDomains:
        print ('Domain name: {0}'.format(domain.name))