码迷,mamicode.com
首页 > 编程语言 > 详细

[python] 获得网站的标题, 非常简单的代码

时间:2015-02-07 06:54:21      阅读:205      评论:0      收藏:0      [点我收藏+]

标签:

挺信手拈来的

def gettitle( url ):
    try:
        _ = re.search('<title>(.*?)</title>', requests.get(url).content)
        print url, _.group(1)
    except:
        pass


[python] 获得网站的标题, 非常简单的代码

标签:

原文地址:http://blog.csdn.net/u010211892/article/details/43596963

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!