I originally had this FindLabel function (which works)...

def FindLabel ( [NAME], [Count_]  ):
  if [Count_] != None:
    return [NAME] +'\n' + "Well Log Count: " + [Count_]

I wanted to format the font of the second line only, after '\n', using formatting tags. This is what I tried, and it did not work...

def FindLabel ( [NAME], [Count_] ):
  if [Count_] != None:
   return"[NAME] +'\n' +  "<FNT name='Arial' size='13'>" & "Well Log Count: " + [Count_] & "</FNT>

I also tried to set a variable, and this did not work either...

def FindLabel ( [NAME], [Count_] ):
  myCount = "<FNT name='Arial' size='13'>" &  "Well Log Count: " + [Count_] & "</FNT>
  if [Count_] != None:
   return"[NAME] +'\n' +  myCount

Any thoughts?


This is python, and in your examples you're using the ampersand (&) to concatenate your string. You don't do this in the unformatted example that works. Use the plus sign - + - instead.Ampersand is used in VBScript.

  • No problem. In VBScript you can use either the ampersand or the plus sign to concatenate strings, but Python uses either the plus sign or commas - e.g. print 'a', 'b' - (at least as far as concatenating in this fashion; there are other methods, such as join(), etc. )
    – recurvata
    Feb 24 '15 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.