Search
 
SCRIPT & CODE EXAMPLE
 

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")
Comment

PREVIOUS NEXT
Code Example
Python :: flask get ip address of request 
Python :: array of 1 to 100 python 
Python :: python - convert index to a column 
Python :: pd read csv unname 
Python :: json file to dict python 
Python :: split string form url last slash 
Python :: split string every n characters python 
Python :: python program to shutdown computer when user is not present 
Python :: popups in tkinter 
Python :: get directory of file python 
Python :: pandas insert column in the beginning 
Python :: array of random integers python 
Python :: pysimplegui double Slider 
Python :: join list with comma python 
Python :: python random number 
Python :: python get newest file in directory 
Python :: pandas group by month 
Python :: change type of array python 
Python :: how to split a string between letters and digits python 
Python :: pylint no name in module cv2 
Python :: python randomise between 0 or 1 
Python :: save model pickle 
Python :: np euclidean distance python 
Python :: print upto 1 decimal place python 
Python :: E: Unable to locate package python3-pip 
Python :: remove non-alphabetic pandas python 
Python :: make length string in pandas 
Python :: membercount discord.py 
Python :: how to change column type to string in pandas 
Python :: python sys is not defined 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =