我得到错误:
文件“C:\ Python34 \ lib \ encodings \ cp1252.py”,第19行,编码返回codecs.charmap_encode(输入,self.errors,encoding_table)[0] UnicodeEncodeError:'charmap'编解码器不能编码字符' \ u0106'位置73:字符映射到
这是我的代码:
import requests
from bs4 import BeautifulSoup
url = 'http://www.privredni-imenik.com/firma/68225-a_expo'
r = requests.get(url)
soup = BeautifulSoup(r.content, "html.parser")
g_data = soup.find_all("div", {"class":"podaci"})
print(g_data)
如何在utf-8中编码数据 . 我尝试过其他主题的解决方案,但它们都不适合我 .
1 回答
它工作,我接收数据,但有奇怪的字符..这是另一个主题的问题:)