elementtree and inclusion of special characters

André andre.roberge at gmail.com
Sat Jun 3 12:46:13 EDT 2006


I'm using elementtree to process some html files, by building a tree,
manipulating it, and writing it back.  One problem I encounter is that
elementtree converts some symbols in an unwanted way.  For example, the
symbol ">" is converted to ">".  This is fine in html code, but not
if the page includes some script like the example below

<script type="text/javascript">
function init() {
var a = 1;
if (a > 0)
   {
   alert("Spam alert");
   }
}
</script>

The resulting code, with "a > 0" is not understood by the browser...

Any suggestions as to how I can circumvent this problem in an easy way?

André




More information about the Python-list mailing list