On Wed, 10 May 2006 15:50:38 GMT in comp.lang.python, John Salerno
<[EMAIL PROTECTED]> wrote:

>Dave Hansen wrote:
>
>>>>> print textwrap.dedent(s).strip().replace('\n',' ')
>> this is a multiline triple-quted string with indentation for nicer
>> code formatting
>
>But I have some newlines that are already embedded in the string, and I 
>wouldn't want those replaced.

>>> s = """
        I want the following line-
        concatenated, but leave this
        line break alone.
        """
>>> print textwrap.dedent(s).strip().replace('-\n',' ')
I want the following line concatenated, but leave this
line break alone.
>>> 

But I'd still recommend using parens and string concatentation.

>>> s2 = (
        "I want the following line "
        "concatentated, but leave this\n"
        "line break alone."
        )
>>> print s2
I want the following line concatentated, but leave this
line break alone.

Regards,
                                        -=Dave

-- 
Change is inevitable, progress is not.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to