Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to check for a particular word in a text file using python

file = open("search.txt")
    print(file.read())
    search_word = input("enter a word you want to search in file: ")
    if(search_word in file.read()):
        print("word found")
    else:
        print("word not found")
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #check #word #text #file #python
ADD COMMENT
Topic
Name
1+3 =