Exemple de lecture d'un fichier JSON avec Python

Langage:
Python
12 vues
0 favoris
Il y a 3 heures

Implémentation du Code

Python
import json

# Open and read the JSON file
with open('data.json', 'r') as file:
    data = json.load(file)

# Print the parsed data
print(data)

Fragment de code le plus simple pour lire un fichier JSON à l'aide de Python, implémenté avec le module intégré json.

#json

Description de l'Extrait

On peut également utiliser json.dumps() pour contrôler l'indentation.

Commentaires

Chargement...