Line Breaks

Stephen Hansen apt.shansen at gmail.com
Mon Nov 23 14:22:44 EST 2009


On Mon, Nov 23, 2009 at 10:45 AM, Susan Day <suzieprogrammer at gmail.com>wrote:

> Hi;
> I have the following line of code I'm sending to postfix:
>
>   msg = 'A Message From %s:\n\n %s' % (string.replace(customer, '_', ' '),
> msg)
>
> Unfortunately, it ignores the line breaks. I also tried %0A but that was
> ignored also. Please advise.
>

Does it ignore ALL line breaks-- or just doubled ones like \n\n? E.g., blank
lines?

I *think* its probably the latter, and doing msg.replace('\n\n', '\n \n')
will make it work. That'd end up with a single space on those blank lines.

HTH,

--S
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091123/2e9a0dcd/attachment.html>


More information about the Python-list mailing list