import os import json # Liste des fichiers JSON à traiter json_files = [f"out_250_{i}.json" for i in range(1, 16)] # Ouvre le fichier list.html en écriture with open("list.html", "w", encoding="utf-8") as f_list: # Pour chaque fichier JSON for json_file in json_files: # Vérifie si le fichier existe if os.path.exists(json_file): # Ouvre le fichier JSON en lecture with open(json_file, "r", encoding="utf-8") as f_json: # Charge le contenu JSON data = json.load(f_json) # Récupère la propriété "html" html_content = data["html"] # Écrit le contenu HTML dans le fichier list.html f_list.write(html_content) else: print(f"Le fichier {json_file} n'existe pas.")