A multiline string is a string value written across several lines. Triple quotes mark its beginning and end, and every character inside—including line breaks—becomes part of the string. section 19.2
A word list stored as one string
words = """art hue ink ... crosshatching """ The value keeps each word and its newline. A loop can inspect each character; when it finds "\n", it knows one word has ended and can extract that word. section 19.2
Triple-quoted strings support two related uses:
- Store readable data spanning many lines, such as the complete list of valid words in a word game. section 19.2
- Document a function with a docstring that describes parameters, behavior, return values, and types. section 21.3
Listing 19.1. Scrabble: Art Edition code for initializations
words = """art #1 hue ink ... crosshatching """ tiles = "hijklmnop" all_valid_words = () #2 start = 0 #3 end = 0 #4 found_words = () #5
Inspect the initialization code to see triple quotes surrounding a multiline word string. section 19.2


