()
Module : json
Écrit un objet Python dans un fichier au format JSON.
📝 Syntaxe
json.dump(obj, fichier)⚙️ Paramètres
objObjet Python à écrire
fichierObjet fichier ouvert en écriture
💡 Exemples
import json
data = {'nom': 'Alice', 'age': 17}
with open('data.json', 'w') as f:
json.dump(data, f)→ Écriture du JSON dans le fichier data.json
