Python Carriage Returns/New Line

Discussion created by BrokenLegMike on May 17, 2011
Latest reply on May 17, 2011 by BrokenLegMike
Hey everyone. I've been pouring through the internet to try to find an example to use carriage returns in a python script. (i.e. vbnewline from vb)

In my script example below I am cycling through the text elements in a series of maps and replacing any of them that contain the text "TITLE BLOCK" with a string composed of variables that read from a look up table.

As you can see I want the first variable to sit on the first line, the second to sit on the second line and so forth.

textElement.text = firstline + '/n' + secondline + '/n' + thirdlinea + " " + thirdlineb

Using the /n new line function, it's supposed to return the next variable to a new line. This is not working for me. I have tried a number of different ways and I either get an error message or all the texts gets placed into the text element box, but it all sits on one line. Does anyone suggest a workaround?


for textElement in arcpy.mapping.ListLayoutElements(mxd2, "TEXT_ELEMENT"):
if textElement.text == "TITLE BLOCK":
                        #print row.SITE
                  textElement.text = firstline + '/n' + secondline + '/n' + thirdlinea + " " + thirdlineb