Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. docs = ["doc1.txt", "doc2.txt", "doc3.txt"]
  2. line = []
  3.  
  4. def word_search(docs, keyword):
  5. kword = keyword
  6. for i in range(len(docs)):
  7. file = open(docs[i])
  8. line.append(file.readline().rstrip('\n').split(" "))
  9. if word_finder(line[0], kword) == True:
  10. return print(docs[i], kword)
  11. line.clear()
  12.  
  13. def word_finder(line, kword):
  14. kword = kword.upper()
  15. for word in line:
  16. word = word.upper()
  17. if word == kword:
  18. return True
  19.  
  20. word_search(docs, "casino")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement