python友情鏈接檢查方法
更新時間:2015年07月08日 11:17:38 作者:光索與諾
這篇文章主要介紹了python友情鏈接檢查方法,涉及Python讀取txt文件進行友鏈查詢的相關技巧,非常簡單實用,需要的朋友可以參考下
本文實例講述了python友情鏈接檢查方法。分享給大家供大家參考。具體實現(xiàn)方法如下:
# _*_ coding:utf-8 _*_ #xiaohei.python.seo.call.me:) #win+python2.7.x import urllib2,re for i, line in enumerate(open('link.txt')): url_ = line.strip() print i,line html = urllib2.urlopen(url_).read() cou = html.count('360buy.com' or 'jd.com') if cou >= 0: print '有' else: print '沒有' print "\n\n"
希望本文所述對大家的Python程序設計有所幫助。
相關文章
Python 制作詞云的WordCloud參數(shù)用法說明
這篇文章主要介紹了Python 制作詞云的WordCloud參數(shù)用法說明,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2021-03-03