import pywikibot as pw
import re as re #Import regex module
site = pw.Site('fr', 'wikipedia')
count = 0
member = pw.Category(site, 'Catégorie:Portail:Bénin/Articles_liés').members(namespaces = [0])
for page in member:
#print(page.title)
content = page.text
match = re.search(r'.*(est une femme).*', content)
match2 = re.search(r'({{Infobox Biographie2}}|{{infobox biographie2}})', content)
notmatch = re.search(r'({{Infobox|{{infobox)', content)
if match and match2:
count = count + 1
print (count)
print(page.title())
1 Na Agontimé 2 Claudine Prudencio 3 Évelyne da Silva