long_string = """ This is a long multi-line string that can contain multiple lines """
In Python, there are several ways to create a long multi-line string. One common method is to use triple quotes (either single or double) to create a string that can span multiple lines as seen in the code above.
Another way to create a long multi-line string is to use the line continuation character () at the end of each line. Here's an example:
long_string = "This is a long " + \ "multi-line string " + \ "that can contain " + \ "multiple lines"
long_string = f"This is a long \ multi-line string \ that can contain \ multiple lines"
long_string = ( "This is a long " "multi-line string " "that can contain " "multiple lines" )
long_string = [ "This is a long ", "multi-line string ", "that can contain ", "multiple lines"]
Learn Flask development and learn to build cool apps with our premium Python course on Udemy.