heredoc and variables
__peter__ at web.de
Fri Jun 4 17:36:31 CEST 2004
> 2) Consider following heredoc
> I have to write it like this to avoid having an empty line added above
> AND below the actual string when using it.
Why would you care about whitespace in HTML?
> So this would produce the extra empty lines
> I actually think that the last piece of code is more readable. Is there
> a way to stop that behaviour or is there a kind of trim function i
> can apply to get rid of the 2 extra lines?
>>> print """\
... here's how \
... to escape \
here's how to escape newlines
More information about the Python-list