[Python-Dev] Multiline string constants, include in the standard library?
Ville Vainio
ville.vainio@swisslog.com
Fri, 26 Jul 2002 10:11:41 +0300
> where stripIndent() has been defined as:
>
> >>> def stripIndent( s ):
> ... indent = len(s) - len(s.lstrip())
> ... sLines = s.split('\n')
> ... resultLines = [ line[indent:] for line in sLines ]
> ... return ''.join( resultLines )
Something like this should really be available somewhere in the standard
library (string module [yeah, predeprecation, I know], string method).
Everybody needs this kind of functionality, and probably more often than
many of the other string methods (title, swapcase come to mind).
-- Ville