[reportlab-users] < in Paragraph

Tim Roberts timr at probo.com
Thu May 4 19:16:03 EDT 2006

On Thu, 04 May 2006 14:32:07 -0600, Chris Crownhart <ccro at kaivo.com> wrote:

>I have a question regarding <, > and & usage in a Paragraph.
>My code is simply this:
>         val = string.replace(val, '<', '&lt;')
>         val = Paragraph(str(val),self.StyleSheet['Normal'])

Why do you have "str(val)"?  Why not just

    val = val.replace('<', '&lt;')
    val = Paragraph(val, self.StyleSheet['Normal'])

>My val is 'Average temp <90.'  And I need the text to wrap.
>If I leave the above string.replace in the code, I get back a PDF with 
>&lt; in it.  If I comment it out, I get this traceback and error:

&lt; is the correct way to do this.  Many of the samples use it.  Can
you show us a complete program that reproduces the problem?

Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.

More information about the reportlab-users mailing list