我正在尝试导入和使用一个名为“维基百科”的模块在这里找到。。。在
https://github.com/goldsmith/Wikipedia
我可以使用dir函数检查所有属性。在
>>> dir(wikipedia)
['BeautifulSoup', 'DisambiguationError', 'PageError', 'RedirectError', 'WikipediaPage', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', 'cache', 'donate', 'exceptions', 'page', 'random', 'requests', 'search', 'suggest', 'summary', 'util', 'wikipedia']
但是维基百科.page不返回其所有子属性(!?)在
^{pr2}$我希望在这个列表中看到像标题,内容这样的属性。我如何知道“页面”中隐藏的属性是什么?在
你可能还想看看
__dict__
这是一个不错的小邓德或者vars也可以做同样的事情:
^{pr2}$因为
wikipedia.page
是一个函数。我想您需要的是WikipediaPage
对象的属性。在这两种类型是不同的。在
^{pr2}$相关问题 更多 >
编程相关推荐