data = """<everything>
<m>Some text before <r/></m>
<m><r/> and some text after.</m>
<m><r/></m>
<m>Text before <r/> and after</m>
<m><b/> Text after a sibling <r/> Text before a sibling<b/></m>
</everything>
"""
f = etree.fromstring(data)
for r in f.xpath('//r'):
    pass
Как можно заменить элемент текстом в lxml?