Re: [Zope] structured text formatting
"Jonothan" == Jonothan Farr <jfarr@real.com> writes:
>> The structured text formating doesn't appear to work properly >> with data extracted from an external SQL database - in >> particular the paragraph type formatting is lost although the >> character type formatting does work. How do I get around this >> problem? Jonothan> Your lines are probably terminated with '\r\n', but Jonothan> structured text requires only '\n'. Jonothan> Try: Jonothan> string.join(string.split(data, '\r\n'), '\n') Thanks - that worked. -- Dr. John A.R. Williams Photonics Research Group Telecommunications Technology Programme Director Aston University
Jonothan> Try:
Jonothan> string.join(string.split(data, '\r\n'), '\n')
Thanks - that worked.
No problem. BTW: I just discovered this neat function called string.replace(). =) This is almost certainly faster: string.replace(data, '\r\n', '\n') I swear, not a day goes by that I don't learn something new about Python. -jfarr ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Hi! I'm a signature virus. Copy me into your .sig to join the fun! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
participants (2)
-
John Williams -
Jonothan Farr