Hello. How I can count the number of sections on a page? --ElBe (talk) 18:37, 10 February 2022 (UTC)
Topic on Manual talk:Pywikibot
You could create a script using extract_sections method from textlib (https://phabricator.wikimedia.org/diffusion/PWBC/browse/master/pywikibot/textlib.py). Or perhaps use external libraries like mwparserfromhell/wikitextparser to do that.