On 2018-05-31 16:44:10 +0100, MRAB wrote: > I was also thinking that it could take the indentation from the first line, > but that if you wanted the first line to have a larger indent than the > remaining lines, you could replace the first space that you want to keep > with a non-whitespace character and then pass that character to the method. > > For example: > > Test = """\ > _ Hello, this is a > Multiline indented > String > """.outdent(padding='_') > > Outdent so that the first line is flush to the margin: > > _ Hello, this is a > Multiline indented > String > > The padding argument tells it to replace the initial '_': > > Hello, this is a > Multiline indented > String
I would prefer to remove the padding, like this: Test = """ | Hello, this is a | Multiline indented |String """.outdent(padding='|') Or write it like this? Test = """| Hello, this is a | Multiline indented |String """.outdent(padding='|') Hmm, the sign of Zorro! :-) I'm starting to like outdent(), but that may be my TIMTOWTDIism speaking. hp -- _ | Peter J. Holzer | we build much bigger, better disasters now |_|_) | | because we have much more sophisticated | | | h...@hjp.at | management tools. __/ | http://www.hjp.at/ | -- Ross Anderson <https://www.edge.org/>
signature.asc
Description: PGP signature
-- https://mail.python.org/mailman/listinfo/python-list