I want make a dictionary from a text file of: layer name,layer file location and then loop through is making variables called the layer name and assigning them arcpy.mapping.Layer(r"layer file location"). I am new to Python, how do I put in the variable name where the layer file location is supposed to be correctly and can I do that?
Here is my code I have so far...
#Pull in a dictionary from reading text file. #Note:Have a text file ready named file.txt that contains lines of: layer name,layer file location. #Assign the text file a variable name TemplateLayers=r("'\\C:\etc\file.text") #Make the dictionary. lyrList={} #Assign the values in the text file to the dictionary. for line in TemplateLayers: k,v=line.strip().split(',') lyrList[k,strip()]=v.strip() f.close() #Make the variables from the layer name and assign them a file layer. for k, v in lyrList.items(): k=arcpy.mapping.Layer(r ----where I am stuck!)