I would like to search for more than one word in a text file and if the word found i would like to save it to a group in which i have files belonging to English,Entertainment etc.The thing is Im unable to search for more than one string in a file.I wrote few lines of code.Can any one please tell me the correct procedure to classify text files.
import shutil
fp=open("net.txt","r") #opening a file for searching
text=fp.read()
fp.close()
search="sandhya" #searching for the term sandhya
index=text.find(search)
print((search), "found at index", index)
print("name file") #telling to which group this input file belongs to
fp=open('name.txt','w')
shutil.copyfile("net.txt","name.txt") #copying
fp=open("net.txt","r")
fp.read()
fp.close()
I hope someone help me out for this
thanks