Is it possible to specify line breaks in multi-line text?
I am setting up text in a variable that I am trying to display i in a Multiline Text chart.
I have tried using \n but that just gets displayed in the chart.
DaveL17 wrote:Hi Jon - I'm using the textwrap() library which strips all '\n' new line characters in the source and then inserts them back it at 'n' characters (effectively making each line as close to the number of specified characters as possible). Let me play with the library a bit to see if there's a way to insert a control character into the text that will be honored by the library.
import textwrap
new_text = ""
new_line = "\n\n"
old_text = u'Greetings\rProfessor\nFalken.[BREAK]Would you like to play a game?[BREAK]How about a nice game of chess?'
for item in old_text.split('[BREAK]'):
new_text += str(textwrap.fill(item, 35)) + new_line
print new_text.rstrip("\n\n")
================================================================================
Mar 20, 2017, 2:30:07 PM
untitled text 3
--------------------------------------------------------------------------------
Greetings Professor Falken.
Would you like to play a game?
How about a nice game of chess?
Users browsing this forum: No registered users and 8 guests