[GIS] Putting coded domains into list to be created in Python script

arcpydomainspython

I have a large list of coded domains.

They are numbers like:
01.6530.01, 05.7991.08, 05.7991.01, 05.7991.06

The code will be the exact same as the description.

I've tried to make a list using:

FRClist = [01.6530.**01**, 05.7991.08, 05.7991.01, 05.7991.06]

but it gave me a syntax error on the 01 that is bolded.

So I tried to change all the values to a string, using:

FRCstr = str(01.6530.**01**, 05.7991.08, 05.7991.01, 05.7991.06)

but it still gave me a syntax error on the same bolded 01.

In the end I hope to put the list into this:

arcpy.AddCodedValueToDomain_management(GDBpath, "FRC", FRClist[x], FRClistp[x] )

I have quite a few domains which require a lot of coded values.

Best Answer

In the Add Coded Value To Domain documentation there are code examples that show you how to do this. It looks like you are trying to submit a list of coded values to a function that is designed to take a coded value at a time. I think you should change your code to iterate through your list instead.

Python will not like 01.6530.01 being treated as a number because it is not a number. To treat it as a string I think you will need to use the str function on each value you add to the list rather than trying to turn the list as a whole into a string.