【发布时间】:2018-08-14 15:26:29
【问题描述】:
解析网站https://beton24.ru/sochi/beton/时编码有问题
from urllib.request import urlopen
from bs4 import BeautifulSoup
html = urlopen('https://beton24.ru/sochi/beton/')
bs = BeautifulSoup(html.read())
result = bs.findAll("span", "catalog-index__link-text")[1]
parse = str(result)
为了得到混凝土的价格,我将结果转换为str,它变成了'from \ xa03 \ u2009836 \ xa0₽'
谁遇到过,怎么解决?谢谢!
【问题讨论】:
-
你期待什么?
-
@AzatIbrakov
urllib.request表示 Python 3,包含\u转义的str也是如此。
标签: python python-3.x parsing encoding beautifulsoup