(Just something I was messing around with, not anything I ever used in production.)
def _left_pad(text, indent=" "): """Maybe I can find a package in pypi for this?""" return "\n".join(indent + line for line in text.split('\n'))
textwrap.indent('hello\nthis\n is a demo', ' ') # ' hello\n this\n is a demo'
I suspect this was a leftover from Python 2.7 days.
(Just something I was messing around with, not anything I ever used in production.)