with open('file1.txt','r+') as f: lines=f.read() words=lines.split() print(len(words))
with open('file1.txt','r+') as f: numw=0 for line in f: words= line.split() print(words) numw += len(words) print(numw)