import json with open('1.txt', 'r', encoding='utf-8') as f1: lines1 = f1.readlines() for x1 in lines1: data1 = json.loads(x1)