5 Nov
2010
5 Nov
'10
6:40 a.m.
Daniel da Silva writes:
To me, this is rather ugly because it messes up the indentation of some_func(). Suppose we could have a multiline string, that when started on a line indented four spaces, ignores the first four spaces on each line of the literal when creating the actual string?
We do. from textwrap import dedent def some_func(): x, y = process_something() val = dedent("""\ <xml> <myThing> <val>%s</val> <otherVal>%s</otherVal> </myThing> </xml> """) % (x, y) return val I don't think the function call is ugly enough to fix with syntax.