Advertisement
biswasrohit20

one

Apr 6th, 2021
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.21 KB | None | 0 0
  1. fname = input("Enter file name: ")
  2.  
  3. num_words = 0
  4.  
  5. with open(fname, 'r') as f:
  6. for line in f:
  7. words = line.split()
  8. num_words += len(words)
  9. print("Number of words:")
  10. print(num_words)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement