我的代码是
final_id = "PlayerID_SCDG" + str(0)
find_id = beautiful_soup_parsing.find("span", id = final_id)
final_id = find_id.text
上面显示的两个final_id变量中的第一个变量的值是诸如
的值PlayerID:
<span id="PlayerID_SCDG">109275</span>
如何找到页面上唯一的玩家ID的数量?
答案 0 :(得分:0)
不确定要做什么。如果要获取值109275
,请尝试
from bs4 import BeautifulSoup
html='''PlayerID:
<span id="PlayerID_SCDG">109275</span>'''
soup=BeautifulSoup(html,'html.parser')
print(soup.find('span',id='PlayerID_SCDG').text)