Skip to content

Instantly share code, notes, and snippets.

@manichabba
Created August 6, 2016 01:25
Show Gist options
  • Save manichabba/b170da86a43c732cad093e606082d3d5 to your computer and use it in GitHub Desktop.
Save manichabba/b170da86a43c732cad093e606082d3d5 to your computer and use it in GitHub Desktop.
fname = input("Enter file name:")
handler = open(fname,'r')
file = handler.read()
words = file.split()
req = input("Enter the word you want to find in the file:")
ans = words.count(req)
print (req," occurs ",ans, " times.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment