Es gibt einen Fehler in der aktuellen Version der Wikipedia-API-Python-Bibliothek. Sie können einen Zweig von lucasdnd on github installieren, die dieses Problem behoben:
pip install git+https://github.com/lucasdnd/Wikipedia.git
(Sie können --upgrade
, wenn Sie bereits installiert)
Jetzt:
>>> import wikipedia
>>> ny = wikipedia.page("New York")
>>> ny.sections
[u'History', u'16th century', u'17th century', u'18th century, the American Revolution, and statehood', u'19th century', u'Immigration', u'September 11, 2001 attacks', u'Hurricane Sandy, 2012', u'Geography', u'Climate', u'Statescape', u'Regions', u'Adjacent geographic entities', u'State parks', u'National parks', u'Administrative divisions', u'Demographics', u'Population', u'Most populous counties', u'Major cities', u'Metropolitan areas', u'Racial and ancestral makeup', u'Languages', u'Religion', u'LGBT', u'Economy', u'Wall Street', u'Silicon Alley', u'Microelectronic hardware and photographic processing', u'Media and entertainment', u'Tourism', u'Exports', u'Education', u'Transportation', u'Government and politics', u'Government', u'Capital punishment', u'Federal representation', u'Politics', u'Sports', u'See also', u'References', u'Further reading', u'External links']
Es hoffentlich fixed in the main library sein werde bald einmal .
Es ist komisch, aber es sieht aus wie 'sections' nie richtig funktioniert. Es gibt immer eine leere Liste zurück. – PatNowak
@PatNowak Wie haben Sie überprüft, dass es immer eine leere Liste zurückgibt? – mahacoder
Ich habe eine Reihe von Websites überprüft. – PatNowak