Data processing 1

json format:
json.loads() converts json format to dictionary format
json.dumps() converts dictionary format to json format

Store the dictionary in the file
with open (path, w, encoding) as f:
json.dump(after, f, indent=4, ensure_ascii=False)
where indent=4 means empty 4 cells

Dictionary format:
pop(key[,default])
deletes the value corresponding to the given key key in the dictionary, and the return value is the deleted value. The key value must be given. Otherwise, the default value is returned.

Guess you like

Origin blog.csdn.net/qq_42967630/article/details/108701985