UnicodeDecodeError: ‘XXX' codec can't decode bytes in position 2-5: illegal multibyte sequence

这个是编码格式错误 多试几个格式 

 

#!/usr/bin/env python
#-*- coding: gb18030 -*- 

from urllib2 import urlopen  
import re

#网易公开课 下载地址抓取
url='http://v.163.com/special/Khan/arithmetic.html'
web=urlopen(url)
read_web=web.read().decode("gb18030")  # utf-8 gbk gb2312
web.close()

  

posted on 2014-05-04 10:13  卡域克  阅读(265)  评论(0)    收藏  举报