with open('a.txt')as f1,open('b.txt')as f2: data1,data2 =f1.read(),f2.read() print(data1) print(data2)