【转】判断URL是否能够访问
import urllib2 def file_exists(url): request = urllib2.Request(url) request.get_method = lambda : 'HEAD' try: response = urllib2.urlopen(request) return True except: return False
原文地址:http://mysrc.sinaapp.com/view_note/?id=395
import urllib2 def file_exists(url): request = urllib2.Request(url) request.get_method = lambda : 'HEAD' try: response = urllib2.urlopen(request) return True except: return False
原文地址:http://mysrc.sinaapp.com/view_note/?id=395