From the following HTML snippet:
Like this:
data = """<link rel="index" href="/index.php" />
<link rel="contents" href="/getdata.php" />
<link rel="copyright" href="/blabla.php" />
<link rel="shortcut icon" href="/img/all/favicon.ico" />
"""
from lxml import etree
d = etree.HTML(data)
d.xpath('//link[@rel="shortcut icon"]/@href')
['/img/all/favicon.ico']