1

My code for labels look like this:

 def FindLabel ( [NAME_GEO] ): 
  if [NAME_GEO]=="Tbilisi" :
     return "<BOL><FNT size ='14'>" + [NAME_GEO] + "</FNT></BOL>"
  elif [NAME_GEO]=="soxumi" :
     return "<BOL><FNT size ='12'>" + [NAME_GEO] + "</FNT></BOL>"
  elif [NAME_GEO]=="baTumi" :
     return "<BOL><FNT size ='12'>" + [NAME_GEO] + "</FNT></BOL>"
  else:
     return [NAME_GEO]

It works but as you can see there are two 'elif' statements for cities, which are pretty much the same. If I wish to have more city names with same label properties as it is for "soxumi" and "baTumi", I would need to add more 'elif' statements.
I wanted to change code, so there would be only one 'elif' statement for "soxumi", "baTumi" and any other cities, however I failed... could anyone suggest how to do it?

1 Answer 1

3
def FindLabel ( [NAME_GEO] ): 
  if [NAME_GEO]=="Tbilisi" :
     return "<BOL><FNT size ='14'>" + [NAME_GEO] + "</FNT></BOL>"
  elif [NAME_GEO] in ("soxumi", "baTumi") :
     return "<BOL><FNT size ='12'>" + [NAME_GEO] + "</FNT></BOL>"
  else:
     return [NAME_GEO]
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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