menu """spam comments here added to stringeggs ditto ""menu 'spam comments here added to string!\neggs menu "spam\ "eggs\nmenu 'spam\neggs\nditto\ncomments here ignored but newlines not automatic triple-quoted strings are useful anytime you need multiline text in your programfor exampleto embed multiline error messages or htmlxmlor json code in your python source code files you can embed such blocks directly in your scripts by triplequoting without resorting to external text files or explicit concatenation and newline characters triple-quoted strings are also commonly used for documentation stringswhich are string literals that are taken as comments when they appear at specific points in your file (more on these later in the bookthese don' have to be triple-quoted blocksbut they usually are to allow for multiline comments finallytriple-quoted strings are also sometimes used as "horribly hackishway to temporarily disable lines of code during development (okit' not really too horribleand it' actually fairly common practice todaybut it wasn' the intentif you wish to turn off few lines of code and run your script againsimply put three quotes above and below themlike thisx ""import os print(os getcwd()"" disable this code temporarily said this was hackish because python really might make string out of the lines of code disabled this waybut this is probably not significant in terms of performance for large sections of codeit' also easier than manually adding hash marks before each line and later removing them this is especially true if you are using text editor that does not have support for editing python code specifically in pythonpracticality often beats aesthetics string literals