Ben Chuanlong Du's Blog

It is never too late to learn.

Hands on the textwrap Module in Python

In [1]:
import textwrap

textwrap.dedent

In [2]:
s = """\
    if [[ -f ... ]]; then
        echo
    fi
    """
In [3]:
print(textwrap.dedent(s))
if [[ -f ... ]]; then
    echo
fi

In [ ]:
 

Comments