dump in python code example

Example 1: 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'''

Example 2: dump()

# dump()

import pickle

data1 = {'a': [1, 2.0, 3, 4+6j],
         'b': ('string', u'Unicode string'),
         'c': None}
               
selfref_list = [1, 2, 3]
selfref_list.append(selfref_list)
               
output = open('data.pkl', 'wb')
               
# Pickle dictionnary using protocol 0.
pickle.dump(data1, output)
               
# Pickle the list using the highest protocol available.
pickle.dump(selfref_list, output, -1)
               
output.close()