I'm having trouble with syntax in 10.2.1, and have have tried just about everything. With arcpy, I am attempting to access a label.expression of an ArcMap layer and modify it to:

lbl.expression = '[FIELDNAME] + "\n" + "taco"'

I can't get the "\n" part to force the rest of the expression to a new line.

  • 3
    This works: lbl.expression = '[FIELDNAME] + vbnewline + "taco"'
    – mfrancis
    Commented Jul 7, 2014 at 14:04
  • @mfrancis... that is for vbscript in the field calculator. The question deals with Arcpy so python.
    – Branco
    Commented Jul 7, 2014 at 14:48

2 Answers 2


It's a Windows thing, use "\r\n" instead.

  • This is a good answer to assert a new line. I built a complex label expression ArcMap would crash when label condition met: [field1] + '\n' + [field2] Changing to[field1] + '\r\n' + [field2] works!
    – dbusses
    Commented Jan 9, 2017 at 16:24

I'm guessing the parser was not changed to python, '\n' does work to force new lines within python label expressions.

enter image description here

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