def _add_indent ( string , indent ) : lines = string . split ( "\n" ) first , lines = lines [ 0 ] , lines [ 1 : ] lines = [ "{indent}{s}" . format ( indent = " " * indent , s = s ) for s in lines ] lines = [ first ] + lines return "\n" . join ( lines )
how to mass de indent python
Add indent of indent spaces to string . split ( \ n ) [ 1 : ]
def _add_indent(string, indent):
    """Add indent of ``indent`` spaces to ``string.split("\n")[1:]``

    Useful for formatting in strings to already indented blocks
    """
    lines = string.split("\n")
    first, lines = lines[0], lines[1:]
    lines = ["{indent}{s}".format(indent=" " * indent, s=s)
             for s in lines]
    lines = [first] + lines
    return "\n".join(lines)