verify a meaningful word by wikipedia


import urllib

def verifyword(word):
url='http://en.wikipedia.org/w/api.php?action=query&list=search&format=jsonfm&srwhat=text&srsearch='
url = url + urllib.quote(word.encode('utf-8'))
res= urllib.urlopen(url).read()
if res.find('"pages":{"-1"')>-1:
return False
return True

posted on 2009-07-31 15:40  xueliangliu  阅读(132)  评论(0编辑  收藏  举报

导航