Hot to split string literals that will across two or more lines ?

Mohammad Jeffry linuxlah at gmail.com
Mon Nov 21 21:25:57 EST 2005


On 11/22/05, Paul McGuire <ptmcg at austin.rr._bogus_.com> wrote:

> Or for a large literal string:
>
> """
> lots of text hundreds of characters long
> more text on another line but we really don't want any line breaks
> in our final string
> so we replace newlines in this multiline string
> with an empty string thus
> """.replace('\n','')
>
> -- Paul



I love your method. The only drawbacks for this method is I can't tell
whether there is blank space at the end of each lines. For EG: the above
string might be

lots of text hundreds of characters longmore text on another.....
^
or

lots of text hundreds of characters long more text on another.....
^





--
And whoever does an atom's weight of evil will see it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20051122/f2bda806/attachment.html>


More information about the Python-list mailing list