Reserved Ampersand Character in Label Expression? ArcGIS 10.3

المشرف العام

Administrator
طاقم الإدارة
I have this code which works...

def FindLabel ([NUMBERNAME], [NUMBER], [BLOCK], [SURNUM]): lineone = "A:"+ [NUMBER] absName = "" + [NUMBERNAME] + "" if [NUMBERNAME] is not None: return lineone + '\n' + absName + '\n' + "BLK:" + [BLOCK] + '\n' + "SEC:"+ [SURNUM] However I have some field values in [NUMBERNAME] that contain the reserved ampersand character (&). If the value contains the ampersand character the label looks like this...

T&P RR COBLK: SEC: Versus (in this example) a label that looks like...

'T&P RR CO'

I have found this doucmentation, which references this code to fix the ampersand issue....

Function FindLabel ([LABELFIELD]) NewString = Replace([LABELFIELD],"&","&") FindLabel = "" & NewString & ""End FunctionThis is in VBScript. How would I do something similar to this in Python?



أكثر...
 
أعلى