f=open('data.txt') print(type(f)) for s in f: print(s,end='')
<class '_io.TextIOWrapper'> This is line 1. Second line. Last line.
f=open('outdata.txt','w') for i in range(5): f.write('This is line {}\n'.format(i)) f.close()
for s in open('outdata.txt'): print(s,end='')
This is line 0 T