Untitled
unknown
python
a year ago
498 B
10
Indexable
import json # Desafio 🥇 aluno = '''{ "name": "John Smith", "age": 30, "city": "New York", "isStudent": true, "gpa": 3.5 }''' #Criando Json com o JSON com os dados da variável 'aluno': with open('desafio.json', 'w', encoding='utf-8') as arquivo_json: json.dump(aluno, arquivo_json) #Lendo os dados do JSON criado: with open('desafio.json', encoding='utf-8') as arquivo: data = json.load(arquivo) readble_data = json.loads(data) print(readble_data['age'])
Editor is loading...
Leave a Comment