当页面存在时,从维基百科搜索查询错误中加载页面

问题描述 投票:2回答:1

当页面肯定存在时运行此代码错误,因为我使用python维基百科库首先获取页面。

import wikipedia

wikiResults = wikipedia.search("megaman 64")
result = wikiResults[0]
page = wikipedia.page(result)

错误返回:

wikipedia.exceptions.PageError: Page id "mega man legends video games" does 
not match any pages. Try another id!

我究竟做错了什么?

谢谢

编辑:提供MCVE

python wikipedia
1个回答
1
投票

我通过查看github解决的问题修复了这个错误。

运行以下行时,auto建议自动设置为true

page = wikipedia.page(result)

禁用此功能可解决此问题:

page = wikipedia.page(result, auto_suggest=False)
© www.soinside.com 2019 - 2024. All rights reserved.