1.dedent
Remove any common leading whitespace from every line in text. Note that tabs and spaces are both treated as whitespace
- simple example
from textwrap import dedent
print(">>>> Here will be a dedenting test:")
print(dedent(""" First Line
Helllooo
Hellooooo
Test!!"""))
>>>> Here will be a dedenting test:
First Line
Helllooo
Hellooooo
Test!!
- format output
import textwrap
name = 'WuwWei'
message = '''\
{name}
hello
world
'''
body = message.format(name=name)
print body
screen output
WuWei
hello
world