Hi ,
Im trying to extract the number 7.2 from the html string below using python:

'''<a href="/ratings_explained">weighted average</a> vote of <a href="/List?ratings=7">7.2</a> / 10</p><p>'''

I thought this would be code to do this .But how come this doesnt work ?

averageget = re.compile('<a href="/List?ratings=7">(.*?)</a>')
average = averageget.findall(htmlr)

Could it be that there some special structures in the html file which I missed out ?

no need to use regex

1) split on "</a>"
2) go through list, check of List?ratings.
3) get index of ">,
4) print

>>> string = '''<a href="/ratings_explained">weighted average</a> vote of <a href="/List?ratings=7">7.2</a> / 10</p><p>'''
>>> for i in string.split("</a>"):
...   if "List?ratings" in i:
...     print i[ i.rindex('">')+2 : ]
...
7.2