Skip to content

Instantly share code, notes, and snippets.

@junaidpv
Created April 20, 2011 12:34
Show Gist options
  • Save junaidpv/931213 to your computer and use it in GitHub Desktop.
Save junaidpv/931213 to your computer and use it in GitHub Desktop.
import wikipedia
import codecs
site = wikipedia.getSite('ml','wiktionary')
input_file = codecs.open("title_list.txt", mode="r", encoding='utf-8')
input_text = input_file.read()
title_list = input_text.split('\n')
start = 0
end = 1000
output_file = codecs.open("olam_words-exist_.txt", mode="a+", encoding = 'utf-8')
for i in range(start, end):
title_text = title_list[i]
page = wikipedia.Page(site, title_text)
ostr = str(i)+". \""+ title_text + "\""
if(page.exists()):
wikipedia.output(ostr + " exists")
output_file.write(ostr+'\n')
else:
wikipedia.output(ostr + " does not exists")
output_file.flush()
output_file.close()
wikipedia.stopme()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment