Django
- 5 ответов
- 0 вопросов
1
Вклад в тег
from lxml.html import fromstring
string = '''<html>
<body>
<div class="post">
text <p> text </p> text <a> text </a>
<span> text </span>
<div class="post">
another text <p> text </p>
</body>
</html>'''
html = fromstring(string)
post = html.xpath('.//div[@class="post"]')[0].text_content()
print post