import urllib.request import re page = urllib.request.urlopen('https://www.cnblogs.com') html = page.read().decode('utf-8') title=re.findall('<title>(.+)</title>',html) print (title)