8 lines
223 B
Python
8 lines
223 B
Python
# textwrap.indent for Python2
|
|
def indent(text, prefix):
|
|
def prefixed_lines():
|
|
for line in text.splitlines(True):
|
|
yield (prefix + line if line.strip() else line)
|
|
|
|
return "".join(prefixed_lines())
|