I run to get some value as score.
score = soup.find('div', attrs={'class' : 'summarycount'})
I run 'print score' to get as follows.
<div class=\"summarycount\">524</div>
I need to extract the number part. I used re module but failed.
m = re.search("[^\d]+(\d+)", score)
TypeError: expected string or buffer function search in re.py at line 142 return _compile(pattern, flags).search(string)
- What's the return type of the find function?
- How to get the number from the score variable?
- Is there any easy way to let BeautifulSoup to return the value(in this case 524) itself?