import json fnimed=[s.strip() for s in open("uudised1.txt").readlines()][1:] v={} for fnimi in fnimed: algus=fnimi[3:13] ots=int(fnimi[14:]) dok=json.load(open("../../ohtuleht/sisend/"+algus+".json")) sisu=dok[ots] #print(sisu) v[fnimi]=sisu with open("uudised1.json", "w", encoding="utf-8") as f2: json.dump(v, f2, ensure_ascii=False)