один
два
три
with open('f.txt') as file:
lines = file.read().splitlines()
for line in lines:
print(line)
with open(line,'w') as file:
file.write('')
The default encoding is platform dependent (whatever locale.getpreferredencoding() returns), but any text encoding supported by Python can be used.