“Python hängt an die JSON -Datei an” Code-Antworten

Fügen Sie die JSON -Datei in Python ein

a_dictionary = {"d": 4}

with open("sample_file.json", "r+") as file:
    data = json.load(file)	# get data from file
    update(a_dictionary)
    seek(0)
    json.dump(data, file)	# insert data in file
Nickton

Python hängt an die JSON -Datei an

import json
with open(path) as f
	data = json.load(f)
	data["new"] = "penguin"
	json.dump(data,f)
Thankful Toucan

Ähnliche Antworten wie “Python hängt an die JSON -Datei an”

Fragen ähnlich wie “Python hängt an die JSON -Datei an”

Weitere verwandte Antworten zu “Python hängt an die JSON -Datei an” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen