I'm new to Python and web scraping so I apology if the question is too basic!
I want to extract the "score" and "rate" (rating) from the following example BeautifulSoup object
import bs4
import re
text = '<html><body>{"count":1,"results":[{"score":"2-1","MatchId":{"number":"889349"},"name":"Match","rating":{"rate":9.0}}],"performance":{"comment":{}}}</body></html>'
page = bs4.BeautifulSoup(text, "lxml")
print type(page)
I have tried these but nothing showed up (just blank [])
tmp = page.find_all(text=re.compile("score:(.*)"));
print(tmp)
tmp = page.findAll("score");
print(tmp)
I found this similar question but it gave me error
tmp = page.findAll(text = lambda(x): x.lower.index('score') != -1)
print(tmp)
AttributeError: 'builtin_function_or_method' object has no attribute 'index'
What did I do wrong? Thanks in advance!