Python乱码问题又来了,访问繁体字网站出乱码怎么破?requests访问,pythonrequests,In [12]: r =
Python乱码问题又来了,访问繁体字网站出乱码怎么破?requests访问,pythonrequests,In [12]: r =
In [12]: r = requests.get('http://www.hkex.com.hk/chi/stat/smstat/dayquot/d170202c.htm')In [13]: r.text[-100:]Out[13]: '´Á®§$2.60\r\n 717 \xad^¬ÓÃÒ¨é ¥½´Á®§$0.0128\r\n\r\n2. «ü¼Æ\xad×\xadq\r\n\r\n-\r\n\r\n</font></pre></body></html>\r\n
根据该网页的代码:
<html><head><meta name='MS.LOCALE' content='ZH-TW'><title>Hong Kong Exchanges and Clearing Limited</title><meta http-equiv='Content-Type' content='text/html; charset=big5'>
需指定字符编码为 big5:
r = requests.get('http://www.hkex.com.hk/chi/stat/smstat/dayquot/d170202c.htm')r.encoding = 'big5'
编橙之家文章,
相关内容
- Python什么方法可以快速简洁的将两个队列变成字典,
- Python requests可以模拟登录需要身份信息的网站吗,pyt
- python语言里函数作用域unBoundError错误问题请教,python
- Python多线程读取文件进程读取到内容不全如何破,pyt
- Python有支持url发送指令控制服务器的方法吗,pythonurl
- 想使用redis和gevent完成实时消息系统求思路,redisgeven
- 要用python获取MySQL连接器如何写,pythonmysql,从MySQL官网上
- cookbook书中关于装饰器的源码里,这个参数是怎么传递的
- Python解决算法复杂度问题求助,python问题求助,问题是
- Python tornado分页合并展示问题,pythontornado,需要在用户输
评论关闭