Last active
January 28, 2017 15:36
-
-
Save AliYmn/5767c27570c75cbb6e048866feab9442 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import wikipedia | |
wikipedia.set_lang("tr") | |
file = open("aranacaklar.txt", "r" , encoding="utf-8") | |
line = file.readlines() | |
words = line | |
for word in words: | |
print(word,' Aranıyor ...') | |
#kelimeleri ara | |
topics = wikipedia.search(word) | |
for i in topics: | |
if(wikipedia.exceptions.DisambiguationError): | |
try: | |
print(wikipedia.summary(topics[topics.index(i)+1]), file=open(i + ".txt", mode="w", encoding="utf-8")) | |
except IndexError or wikipedia.exceptions.PageError: | |
pass | |
else: | |
try: | |
print(wikipedia.summary(topics[topics.index(i)]), file=open(i + ".txt", mode="w", encoding="utf-8")) | |
except IndexError or wikipedia.exceptions.PageError: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment