with open("file.txt") as file_in:
lines = []
for line in file_in:
lines.append(line)
with open('pagehead.section.htm','r') as f:
output = f.read()
f = open("test.txt", mode='r', encoding='utf-8')
# Open function to open the file "MyFile1.txt"
# (same directory) in append mode and
file1 = open("MyFile.txt","a")
# store its reference in the variable file1
# and "MyFile2.txt" in D:\Text in file2
file2 = open(r"D:\Text\MyFile2.txt","w+")