如果是非定向爬虫,不是专门爬一个固定位置的信息,而是成千上万的未知网站,那就需要找到编码格式了,使用如下正则,可以正确找到,准确率99%content=requests.get(url).contentbianma_group=re.search('<meta[sS]*?charset="?([a-zA-Z0-9-]*)', respbody0, re.IGNORECASE)
if bianma_group: print bianma_group.group(1)