使用python获取wikipedia摘要

使用python获取wikipedia摘要,python,mediawiki,Python,Mediawiki,我想得到一篇维基百科文章的第一段。所以我使用的是wikitools from wikitools import wiki from wikitools import api from wikitools import page wikiobj = wiki.Wiki("http://en.wikipedia.org/w/api.php") wikipage = page.Page(wikiobj, title="Office_Space") wikidata = wikipage.getWik

我想得到一篇维基百科文章的第一段。所以我使用的是
wikitools

from wikitools import wiki
from wikitools import api
from wikitools import page

wikiobj = wiki.Wiki("http://en.wikipedia.org/w/api.php")
wikipage = page.Page(wikiobj, title="Office_Space")
wikidata = wikipage.getWikiText(True)
print wikidata
这是。在这个结果中有很多标签。我不要这些

我只需要
文章
中的以下部分。(从维基百科复制粘贴)。可能吗?谢谢或者有没有其他选择。非常感谢你

   Office Space is a 1999 American comedy film satirizing work life in a typical 1990s software company. Written and directed by Mike Judge, it focuses on a handful of individuals fed up with their jobs portrayed by Ron Livingston, Jennifer Aniston, Gary Cole, David Herman, Ajay Naidu, and Diedrich Bader.
   The film's sympathetic depiction of ordinary IT workers garnered a cult following within that field, but also addresses themes familiar to white collar employees in general.
   Shot in Las Colinas and Austin, Texas, Office Space is based on Judge's Milton cartoon series. It was his first foray into live action film and second full length motion picture release.
中的模板解析器(在中引用)看起来允许您将wikitools返回的所有内容放入Python数据结构中,您可以从中提取所需的位

编辑:您可能也会发现Python库在这方面很有用,如中所述。

中的模板解析器(在中引用)看起来允许您将wikitools返回的所有内容放入Python数据结构中,您可以从中提取所需的位


编辑:您可能还发现Python库在这方面很有用,如中所述。

最后我找到了脚本。这是在工作状态。无论如何谢谢你


我终于找到了脚本。这是在工作状态。无论如何谢谢你