我试图用html charset部分网页抓取一个网页
<meta http-equiv="Content-Type" content="text/html; charset=windows-1253">
整个html而不是希腊字符显示以下内容
我得到的字符就像
'¢ìåóá ÄéáèÝóéìï'
'20,65\xa0\x80'
我尝试将其转换为
price.text.strip().decode('cp1253').encode('utf8')
soup = BeautifulSoup(Myhtml, 'html.parser').decode('cp1251').encode('utf8')
但再一次,只有无效的人物
经过多次测试后,我最终得到以下结论
if r.status_code == 200:
r.encoding = 'cp1253'
Myhtml = r.text