Answers for "find word in text file python"

2

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")
Posted by: Guest on August-10-2020
1

how to find word in file python

with open('example.txt') as f:
    if 'blabla' in f.read():
        print("true")
Posted by: Guest on February-14-2021
0

how to read specific words from a file in python

fo = open("output.txt", "r+")
str = fo.readline()
str = str[7:11]
print("Read String is : ", str)
fo.close()
Posted by: Guest on July-12-2020
0

how to read specific words from a file in python

fo = open("output.txt", "r+")
str = fo.readline()
str = str[7:11]
print "Read String is : ", str
fo.close()
Posted by: Guest on July-12-2020

Code answers related to "find word in text file python"

Python Answers by Framework

Browse Popular Code Answers by Language