使用Beautifulsoup刮取格式奇怪的数字

2024-09-30 14:15:22 发布

您现在位置:Python中文网/ 问答频道 /正文

我尝试使用BS4Python来刮取HTML表,但是对于HTML中的247 759 384read as 247759384)格式的数字,Python中的显示方式不同。我想输出他们,因为他们在表中

temp = []
a = soup.findAll('tr')[1]
for td in a.find_all("td"):
    temp.append(str(td.text))
    #print(str(td.text))
a.findAll('td')[10].text

给我一个

'24\xa0081\xa0728'

而不是

24081728

Tags: textinforreadhtmlas格式数字

热门问题