contents = {"aa": 12, "bb": 21} with open("myfile1.txt", "w+") as file: file.write(str(contents))
with open('myfile1.txt', "r+") as file: contents = file.read() print(contents)