python解析网页的字符编码

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

import urllib.request
import re
content = urllib.request.urlopen("http://www.open-open.com/")
x = str(content.info())
match = re.search('charset=(?P<charset>\\w*)', x, re.IGNORECASE)
if match:
    temp = x.decode(match.group('charset'))