Indent String

Add indentation to each line of a string.

Code

General
import textwrap
return textwrap.indent(s, ' ' * spaces)

Parameters

Multi-line string

Number of spaces to indent

Server

More Python Snippets