我最近一直在使用維基百科模塊來確定一個隨機的維基百科頁面。維基百科消歧錯誤
我一直在用言語非常大名單這樣做,和random.choice()模塊像這樣:
words=open("words.txt","r")
words=words.read()
words=words.split()
text=random.choice(words)
string=random.choice(wikipedia.search(text))
p = wikipedia.page(string)
系統似乎最常打交道的,不過偶爾也會憋出來的錯誤:
Traceback (most recent call last):
File "/home/will/google4.py", line 25, in <module>
p = wikipedia.page(string)
File "/usr/local/lib/python2.7/dist-packages/wikipedia/wikipedia.py", line 276, in page
return WikipediaPage(title, redirect=redirect, preload=preload)
File "/usr/local/lib/python2.7/dist-packages/wikipedia/wikipedia.py", line 299, in __init__
self.__load(redirect=redirect, preload=preload)
File "/usr/local/lib/python2.7/dist-packages/wikipedia/wikipedia.py", line 393, in __load
raise DisambiguationError(getattr(self, 'title', page['title']), may_refer_to)
DisambiguationError: "The Scarf" may refer to:
The Scarf (film)
The Scarf (opera)
Scarf (disambiguation)
Arthur Stewart King Scarf
有反正我可以繞過嗎?