cannot modify text in a html tree

Bug #1755841 reported by Tudor
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxml
Invalid
Undecided
Unassigned

Bug Description

I'm on:

Python : sys.version_info(major=2, minor=7, micro=14, releaselevel='final', serial=0)
lxml.etree : (4, 1, 1, 0)
libxml used : (2, 9, 7)
libxml compiled : (2, 9, 7)
libxslt used : (1, 1, 32)
libxslt compiled : (1, 1, 32)

I'm unable to modify the text located in the 'text3' position. I can find it using itertext() on the body element, but not much more.

from lxml import etree
from io import StringIO

orig_html = """
<html>
<body>
text1
<div align="center">
text2
</div>
text3
</body>
</html>
""".decode('utf8')

parser = etree.HTMLParser()
tree = etree.parse(StringIO(orig_html), parser)

# how do i modify text3 into something else?

Revision history for this message
scoder (scoder) wrote :

Please don't use the bug tracker for user support requests.
http://lxml.de/tutorial.html#elements-contain-text

Changed in lxml:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.