[New-bugs-announce] [issue13857] Add textwrap.indent() as counterpart to textwrap.dedent()

Nick Coghlan report at bugs.python.org
Wed Jan 25 04:37:15 CET 2012


New submission from Nick Coghlan <ncoghlan at gmail.com>:

As far I am aware, the simplest way to indent a multi-line string is with the following snippet:

    '\n'.join((4 * ' ') + x for x in s.splitlines())

It would be a lot simpler and clearer if I could just write that as "textwrap.indent(s, 4 * ' ')".

(i.e. indent would accept a prefix string to be inserted before each line in the supplied string, as in the original comprehension)

----------
components: Library (Lib)
messages: 151932
nosy: ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Add textwrap.indent() as counterpart to textwrap.dedent()
type: enhancement
versions: Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13857>
_______________________________________


More information about the New-bugs-announce mailing list