2

I can get content of a Wikipedia section if I ask for a specific section, for example:

import wikipedia
print(wikipedia.WikipediaPage('Sleep Well Beast').section("Promotion"))

but when I try to get all the sections, I get an empty list, why?

print(wikipedia.WikipediaPage('Sleep Well Beast').sections)

According to documentation, this should give a list of sections:

https://wikipedia.readthedocs.io/en/latest/code.html#api

user3722736
  • 191
  • 1
  • 2
  • 12

1 Answers1

0

You need to install the wikipedia_sections libary using

pip install wikipedia_sections
Ole Pannier
  • 3,208
  • 9
  • 22
  • 33