- 29 名前:nobodyさん [2011/04/23(土) 05:04:00.77 ID:Z9ryHxYt]
- >>27
contentがNoneかどうかはifで予め判断してます。以下ソース一部。 resultはURLかNoneを格納し、wget()はcontentかNoneを返します。 if result: self.response.headers['Content-Type'] = 'text/plain' html = self.wget(result) if html is None: return else: bs = BeautifulSoup.BeautifulSoup(html) a_tag = bs.find('a') a_tag.extract() self.response.out.write( str(bs) )
|

|