# -*- coding: utf-8 -*- """ Created on Sat Oct 1 20:26:41 2022 @author: Roman """ import json s = 'rrrrrrrr' f = open('test.txt', 'a') f.write(s) f.close() f = open('test.txt', 'r') s1 = f.read() f.close() print(s1) with open('test.txt', 'r') as f: s1 = f.read() print(s1) d1 = {"a":1, "b": 7, "c":8} with open('test.json', 'w') as f: f.write(json.dumps(d1)) with open('test.json', 'r') as f: d2 = json.load(f) print(d2)