The simplest is to use python triple quotes (note the three single quotes)
stringtowrite = '''abcd || efgh|| iklk'''
any string literal with triple quotes will continue in the next line. You can use '' 'or "".
By the way, if you have
a = abcd b = efgh c = iklk
I would recommend the following:
stringtowrite = "%s||\n%s||\n%s" % (a,b,c)
as a more readable and pythonic way to do this.
source share