I've got a number of different labeling scripts I use and they all at least contain one NAME type field I display. On the rare occasion, I have names that contain the "&" (such as "Rough & Ready").
I know the ampersand is a special character and when I use it in my script it starts displaying the other fileds parameters in the output text.
Here is an example of one of my simple labeling codes in Python:
def FindLabel([Name_1],[Width_1]):
str_list = []
if [Name_1] not in (None, "<NULL>","<Null>", "", "0"):
str_list.append([Name_1])
if [Width_1] not in (None, "<NULL>","<Null>", "", "0", " ","Varies"):
Width_1_str = '<ITA>Width = {}\'</ITA>'.format("<ITA>" + [Width_1] + "</ITA>")
str_list.append(Width_1_str)
label_str = '\n'.join(str_list)
return(label_str)
I have found an example using VB and somehow incorporating "&","&" into the script, but I have played around with adding variations of that in my code, but I can't seem to get it to work without errors.
Any ideas how to simply allow & into my Name_1 field in this example?
Thanks