Python Idioms: Multiline Strings

I rarely see Multiline strings used in Python code outside of docstrings, but they can be very useful, especially when you need to create a very specifically structured string, like a code snippet, help section to print to the screen or ASCII art for a snake. The problem is that it’s just ugly, because indenting the strings actually inserts the indentation into the string. So you have to do this:

This is a companion discussion topic for the original entry at

Thanks a lot for your post, that is a cool. (I had the problem of indentation recently and wasn’t aware of the presence of textwrap.dedent in stdlib !).