Ejemplo 1: ¿que son las cargas y volcados json simples?
loads() takes in string and returns a json object.
dumps() takes in json object and returns a string.
Also remember.
Serialization - converts python to json
Deserialization - Converts json to python.
Ejemplo 2: volcado de python json
import json
with open("data_file.json", "w") as write_file:
json.dump(data, write_file)
Ejemplo 3: json.dumps python
example={
"Playlists": [
"Default"
],
"Default": [
"Resources\Media\C.mp3",
"Resources\Media\K.mp3"
]
}
import json
json_file_path=input('Enter the path: ')
with open(json_file_path,'w') as hand:
json.dumps(example,hand,indent=4)
'''# dict,file_pointer,indentation'''
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)