“archivo abierto de python json” Código de respuesta

Python Leer el archivo JSON

import json

with open('path_to_file/person.json') as f:
  data = json.load(f)

print(data)
MzanziLegend

JSON Dump para archivar

import json

data = {"key": "value"}

with open('data.json', 'w') as jsonfile:
    json.dump(data, jsonfile)
Attractive Ape

Abrir archivo JSON Python

import json

with open('data.txt') as json_file:
    data = json.load(json_file)
ANEREL

archivo abierto de python json

import json

#reading
with open(file_name, 'r') as f:
	data = json.load(f)

#writing
with open(file_name, 'w') as f:
	json.dump(data, f) #use indent to make easyer to read eg. indent = 4
Eager Elephant

Leer el archivo json python

import json

with open('path_to_file/person.json') as f:
  data = json.load(f)
print(data)

flx = json.dumps(data, ensure_ascii=False, indent=4)
print(flx)
JJSSEECC

escribir json pythonb

import json

with open('data.txt') as json_file:
    data = json.load(json_file)
    for p in data['people']:
        print('Name: ' + p['name'])
        print('Website: ' + p['website'])
        print('From: ' + p['from'])
        print('')
Nyn

Respuestas similares a “archivo abierto de python json”

Preguntas similares a “archivo abierto de python json”

Más respuestas relacionadas con “archivo abierto de python json” en Python

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código