>>> stroka = """<td class="text" align="center" style="font-family: Arial, sans-serif; color:#646464; font-size: 13px; line-height: 15px; text-decoration: line-through;">
... <span style="font-family: Arial, sans-serif; color:#646464; font-size: 13px; line-height: 15px; text-decoration: line-through;">
... 53.63 Р<!-- <span class="oldprice4">53,63</span> -->
... </span>
... </td>"""
>>> from lxml import etree
>>> from io import StringIO
>>> parser = etree.HTMLParser()
>>> tree = etree.parse(StringIO(stroka), parser)
>>> tree.xpath('.//td/span')[0].text
'\n 53.63 Р'
>>> tree.xpath('.//td/span')[0].text.replace('\n','').strip()
'53.63 Р'
....
your_data = StringIO.StringIO()
your_data.write(xml)
your_data.seek(0)
tree = etree.parse(your_data)
f = open(file_events, 'r')
tree = etree.parse(file_events)
# -*- coding: utf-8 -*-
from lxml import etree
import StringIO
test ="""<employees>
<employee>
<id>1</id>
<name>Oleg</name>
</employee>
<employee>
<id>2</id>
<name>Masha</name>
</employee>
</employees>"""
fl = StringIO.StringIO()
fl.write(test)
fl.seek(0)
tree = etree.parse(fl)
your_var = 2
event_name2 = tree.xpath(r'.//id[text() = "{id}"]/../name/text()'.format(id=your_var))
print event_name2
['Masha']
[Finished in 0.1s]