python解析网页的字符编码
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'))
\\w*)', x, re.IGNORECASE) if match: temp = ">
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'))