17 lines
564 B
Python
17 lines
564 B
Python
import requests
|
|
from bs4 import BeautifulSoup
|
|
|
|
# URL de la page principale
|
|
url = "https://www.resultats-elections.interieur.gouv.fr/europeennes2024/index.html"
|
|
|
|
# Récupérer le contenu HTML de la page
|
|
response = requests.get(url)
|
|
soup = BeautifulSoup(response.content, "html.parser")
|
|
|
|
# Extraire les attributs des éléments "g" dans "g#departements"
|
|
departements_element = soup.find("div", id="container-map")
|
|
if departements_element:
|
|
dep_paths = departements_element.find_all("path")
|
|
for dep_path in dep_paths:
|
|
onclick = dep_path.get('onclick')
|