Skip to content

Instantly share code, notes, and snippets.

@cindygis
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cindygis/dad9bfc8f5f115519a74 to your computer and use it in GitHub Desktop.
Save cindygis/dad9bfc8f5f115519a74 to your computer and use it in GitHub Desktop.
Prints out a list of code-value pairs for a given attribute domain in a workspace.
import arcpy
arcpy.env.workspace = "Database Connections\arb.sde"
cvd = "cvd_District"
for dom in arcpy.da.ListDomains():
if dom.name == cvd:
for i in dom.codedValues.iteritems():
print i
# One liner
cvd_pairs = [i for i in dom.codedValues.iteritems() for dom in arcpy.da.ListDomains() if dom.name == cvd]
for cv in cvd_pairs: print cv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment