import lxml.html doc = lxml.html.parse('http://python.su/forum/topic/16176/') title = doc.xpath('//title')[0] print lxml.html.tostring(title, encoding='utf-8')