python解析网页的字符编码 2015/01/06 15193 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'))