Issue
Fairly new to beautiful soup. Trying to parse this tag
html
<score-bill scoreA="86" audiencestate="upright" data-qa="score-panel" data-scoresmanager="scorebill:scoreAction" id="scoreboard" mediatype="assetseries" rating="" skeleton="panel" scoreb="98" assetstate="active">
Desired Results
86
Question
How do I parse the value in this tag?
Any help would be greatly appreciated
Solution
You can search the tag with find
html = '<score-bill scoreA="86" audiencestate="upright" data-qa="score-panel" data-scoresmanager="scorebill:scoreAction" id="scoreboard" mediatype="assetseries" rating="" skeleton="panel" scoreb="98" assetstate="active">'
soup = BeautifulSoup(html, 'lxml')
results = soup.find('score-bill')['scorea']
print(results) # 86
Answered By - Guy
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.