import re

with open(r'D:\Evolução categorias\sistema_dfe.html', 'r', encoding='utf-8') as f:
    html = f.read()

# Find sidebar nav items
for m in re.finditer(r'data-page="[^"]+"', html):
    print(m.group())

print()
# Find section ids
for m in re.finditer(r'id="(page-[^"]+)"', html):
    print('section:', m.group())

print()
print('Tem dre-consolidado?', 'dre' in html.lower())
# Show sidebar HTML snippet
idx = html.find('data-page=')
if idx > 0:
    print('\n--- SIDEBAR SNIPPET ---')
    print(html[max(0,idx-200):idx+800])
