import pywikibot
import re
import mwparserfromhell as mwh
import pprint

site = pywikibot.Site(u"en", fam=u"wikipedia")
# wpage = pywikibot.Page(site, u"Artificial_neural_network")

# # Trying
# item = pywikibot.ItemPage.fromPage(wpage)
# item_dict = item.get()
# item_dict['sitelinks']['enwiki']
category_name = 'Computer science'
wpage = pywikibot.Category(site, category_name)
print(wpage.categoryinfo)

# Subcategories:
# for x in wpage.subcategoriesList():
#     print(x)

for article in wpage.articles():
    print(article, end='')
    print(" " + str(type(article)))
    print(article.title())
    print("is-category? ", end='')
    print(article.isCategory())
    print("\n")
    
{'size': 43, 'subcats': 17, 'files': 0, 'pages': 26}
[[en:Computer science]] <class 'pywikibot.page.Page'>
Computer science
is-category? False


[[en:Outline of computer science]] <class 'pywikibot.page.Page'>
Outline of computer science
is-category? False


[[en:Business software]] <class 'pywikibot.page.Page'>
Business software
is-category? False


[[en:Computational social choice]] <class 'pywikibot.page.Page'>
Computational social choice
is-category? False


[[en:Computer engineering]] <class 'pywikibot.page.Page'>
Computer engineering
is-category? False


[[en:Critical code studies]] <class 'pywikibot.page.Page'>
Critical code studies
is-category? False


[[en:Information and Computer Science]] <class 'pywikibot.page.Page'>
Information and Computer Science
is-category? False


[[en:Instance selection]] <class 'pywikibot.page.Page'>
Instance selection
is-category? False


[[en:OpenCV]] <class 'pywikibot.page.Page'>
OpenCV
is-category? False


[[en:Philosophy of computer science]] <class 'pywikibot.page.Page'>
Philosophy of computer science
is-category? False


[[en:Programmer]] <class 'pywikibot.page.Page'>
Programmer
is-category? False


[[en:Quaject]] <class 'pywikibot.page.Page'>
Quaject
is-category? False


[[en:Reduction Operator]] <class 'pywikibot.page.Page'>
Reduction Operator
is-category? False


[[en:Sanghamitra Mohanty]] <class 'pywikibot.page.Page'>
Sanghamitra Mohanty
is-category? False


[[en:Social cloud computing]] <class 'pywikibot.page.Page'>
Social cloud computing
is-category? False


[[en:Software]] <class 'pywikibot.page.Page'>
Software
is-category? False


[[en:Computer science in sport]] <class 'pywikibot.page.Page'>
Computer science in sport
is-category? False


[[en:Symbolic execution]] <class 'pywikibot.page.Page'>
Symbolic execution
is-category? False


[[en:Technology transfer in computer science]] <class 'pywikibot.page.Page'>
Technology transfer in computer science
is-category? False


[[en:Trace Cache]] <class 'pywikibot.page.Page'>
Trace Cache
is-category? False


[[en:Transition (computer science)]] <class 'pywikibot.page.Page'>
Transition (computer science)
is-category? False


[[en:Viola–Jones object detection framework]] <class 'pywikibot.page.Page'>
Viola–Jones object detection framework
is-category? False


[[en:Visual computing]] <class 'pywikibot.page.Page'>
Visual computing
is-category? False


[[en:Wiener connector]] <class 'pywikibot.page.Page'>
Wiener connector
is-category? False


[[en:Wojciech Zaremba]] <class 'pywikibot.page.Page'>
Wojciech Zaremba
is-category? False


[[en:Portal:Computer science]] <class 'pywikibot.page.Page'>
Portal:Computer science
is-category? False