python3根据网站url,爬取网站title
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 27 11:24:49 2019
@author: jerry
"""
import re
import requests
from bs4 import BeautifulSoup
import csv
def pick_charset(html):
"""
从文本中提取 meta charset 网站编码类型
:param html:
:return:
# """
charset = None
m = re.compile('<meta .*(http-equiv="?Content-Type"?.*)?charset="?([a-zA-Z0-9_-]+)"?', re.I)