I'm having a tough time figuring out a solution to this one. I need to construct a single string with newlines that is built from a dynamic array. For example
mylist = ['first line', 'second line', 'third line', 'fourth line']
The single text string will need to ultimately be this:
preamble = 'My preamble'
postamble = 'My postable'
TEXT = preamble+'\n'+mylist[0]+'\n'+mylist[1]+'\n'+mylist[2]+'\n'+mylist[3]+'\n'+postamble
Here is the catch, the length of mylist is dynamic so TEXT must automatically adjust. So if mylist is this:
mylist = ['first line', 'second line', 'third line']
then my TEXT will automatically be this:
TEXT = preamble+'\n'+mylist[0]+'\n'+mylist[1]+'\n'+mylist[2]+'\n'+postamble
Appreciate any help