Return to Snippet

Revision: 12503
at March 17, 2009 15:55 by tamuratetsuya


Initial Code
def checkWiki(word):
    if word != '':
        url = 'http://ja.wikipedia.org/wiki/'+urllib.quote(word.encode('utf-8'))
        #getHtml=unicode(urlfetch.fetch(url).content,'cp932')
        getHtml=urlfetch.fetch(url).content    
        html_analyzed = BeautifulSoup(getHtml)
        for node in html_analyzed.findAll('div', {'class': 'plainlinks'}):
            #print >>sys.stderr,'node=%s'%node('b')[0](text = True)[0]
            if node('b')[0](text = True)[0].find(u'ありません')==-1:
                print >>sys.stderr,'yes'
                return 1
            else:
                print >>sys.stderr,'ng'
                return 0
        return 1
    else:return 0

Initial URL


Initial Description


Initial Title
wikipediaに単語があるかどうかのチェック

Initial Tags
google, python, django

Initial Language
Python