Leon wrote: > example: > s = ' ' ---> That's technically not HTML encoding, that's replacing a perfectly valid space character with a *non-breaking* space character. If that's all you want to do, then:
s.replace(' ', ' ') will do it. If, however, you wish to quote special HTML chars, like <, > and &, then: cgi.escape(s) will do that for you. From the library reference for "escape( s[, quote])": Convert the characters "&", "<" and ">" in string s to HTML-safe sequences. Use this if you need to display text that might contain such characters in HTML. If the optional flag quote is true, the double-quote character (""") is also translated; this helps for inclusion in an HTML attribute value, as in <A HREF="...">. Richard -- http://mail.python.org/mailman/listinfo/python-list