我正在尝试使用以下代码从标记中提取innerHTML:
theurl = "http://na.op.gg/summoner/userName=Darshan"
thepage = urlopen(theurl)
soup = BeautifulSoup(thepage,"html.parser")
rank = soup.findAll('span',{"class":"tierRank"})
Run Code Online (Sandbox Code Playgroud)
但是我[< span class="tierRank" > Master < /span >]反而得到了。我想显示的只是值“ Master”。
使用soup.get_text代替soup.findall不起作用。
我尝试将.text和添加.string到最后一行的末尾,但这也不起作用。