I need to provide a default value for an input.textarea() which is a long multi line string containing code.
I'm aware that I can use this approach to break lines
text = "line 1\nline2\n..."
And even combine it with this to do line wrapping for better readability
text = 'line 1\
line2...'
Using the \ character.
But it'd be much better if there was a "start and end multi line escape codes".
For example if that was ''' then it would only be a matter of doing:
text = '''line 1
line 2
line 3'''
Many languages offer this and it makes it much easier when the text requires to be copy pasted from/to the code for further editing externally.
There is no such function, unfortunately. In the code you have to explicitly declare a new line with escape+n -
\n.Multiple lines will still be combined into one line if you don't put \n. In case you put a breaker and then use a space before the character, it will be included in the result:
You can also use a oneliner which will result in a multi-line string because of the breakers.