How can I define python multi line string containing """ (3 double quotes)
my desired output is
"""
TEST
"""
Reason: I am writing a script to create some boilerplate code.
How can I define python multi line string containing """ (3 double quotes)
my desired output is
"""
TEST
"""
Reason: I am writing a script to create some boilerplate code.
Use triple single quotes:
'''
"""Test"""
'''
You can also try,
>>> a = "\"\"\"TEST\"\"\""
>>> print a
"""TEST"""
>>>
The solution with '''
should work, but just for the case you need both of them in a string, you can predefine a string with one of them, such as
TRIPSING = "'''"
TRIPDOUB = '"""'
and then
MYSTRING = TRIPDOUB + "\nTEST\n" + TRIPDOUB