Files
sisvietnamvn_01/sisvietnamvn_main/parse_dropdowns.py
T

12 lines
439 B
Python

with open('src/main/resources/templates/doctor.html', 'r', encoding='utf-8') as f:
text = f.read()
import re
# Find the start of the dropdown buttons container
match = re.search(r'--Theo chuyên khoa--.*?</div>', text, re.DOTALL)
if match:
start_idx = text.rfind('<button', 0, match.start())
end_idx = text.find('</button>', match.end()) + 9
print(text[start_idx:end_idx + 1000]) # Print the button and following content