I run to get some value as an indicator.
score = soup.find('div', attrs={'class' : 'summarycount'})
I run 'print score' to get the following.
<div class=\"summarycount\">524</div>
I need to extract the number. I used re module but could not.
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 is the return type of the search function?
- How to get a number from an evaluation variable?
- Is there any easy way to let BeautifulSoup return a value (in this case 524)?
source share