Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

title中文乱码bug #4

Open
grayguest opened this issue Oct 17, 2019 · 0 comments
Open

title中文乱码bug #4

grayguest opened this issue Oct 17, 2019 · 0 comments

Comments

@grayguest
Copy link

对于utf-8编码的网页,如果有中文title,需要使用rp.content而不是rp.text
p = BeautifulSoup(rp.content, "html5lib", fromEncoding='utf-8')

参考:如何解决用 Beautiful Soup 抓取网页却得到乱码的问题? - 知乎
https://www.zhihu.com/question/19696249/answer/255393036

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant