美文网首页
BeautifulSoup 编码问题

BeautifulSoup 编码问题

作者: Cocoa_Coder | 来源:发表于2018-09-12 10:02 被阅读12次

源码记录一下
detailURL = "http://www.houzihome.com"

html = requests.session().get(detailURL, headers=headers)
print(html.encoding)//编码方式 (request 猜的 不一定对)

html.encoding = "utf-8"//指定编码方式 ,具体内容查看原网页编码方式
bsobj = BeautifulSoup(html.text, "html.parser")
print(bsobj)

参考自
http://www.jianshu.com/p/69401b84419e
仅做记录

相关文章

  • BeautifulSoup 编码问题

    源码记录一下detailURL = "http://www.houzihome.com" html = requ...

  • BeautifulSoup文档学习4-输出

    输出 格式化输出 ​ prettify()方法将BeautifulSoup的文档树格式化后以Unicode编码...

  • 豆瓣日记、新浪博客爬虫(python)

    前因 豆瓣日记 先分析脚本结构,再用BeautifulSoup处理 新浪博客 新浪的编码特别奇怪,网上的.deco...

  • 爬虫任务二

    2.1 学习beautifulsoup 学习beautifulsoup,并使用beautifulsoup提取内容。...

  • BeautifulSoup(BS4)的基本使用

    一、BeautifulSoup简介 二、BeautifulSoup安装 三、BeautifulSoup基本使用 导...

  • BeautifulSoup基础使用

    1. 安装BeautifulSoup BeautifulSoup官方文档 BeautifulSoup安装命令:co...

  • Tech Base

    编码问题,参考这个博客,足够了编码问题

  • beautifulsoup教程

    beautifulsoup教程 BeautifulSoup4是爬虫必学的技能。BeautifulSoup最主要的功...

  • 编码问题

    将unicode转换成字符串,即json.dumps(xxx),Python读取的字符串已经是unicode编码,...

  • 编码问题

    关于ASCII,GBK,Unicode,utf-8,base64等编码的问题,我就不重复造轮子了,看到一篇文章:字...

网友评论

      本文标题:BeautifulSoup 编码问题

      本文链接:https://www.haomeiwen.com/subject/rrrbtxtx.html