1👍
Use xpath:
//div[@id="quranOutput"]/a[@class="key"]/@name
>>> import lxml.html
>>>
>>> root = lxml.html.fromstring('''
... <html>
... <body>
... <div id="quranOutput">
... <a class="key" name="1:1"></a>
... <div class="verse ayahBox1" id="verse_1"></div>
... </div>
... </body>
... </html>''')
>>>
>>> print root.xpath('//div[@id="quranOutput"]/a[@class="key"]/@name')
['1:1']
Source:stackexchange.com