I want to check how many times a word is repeating in the file. I have seen other codes on finding words in file but they won't solve my problem.From this I mean if I want to find "Python is my favourite language"The program will split the text will tell how many times it has repeated in the file.

```
def search_tand_export():
        file = open("mine.txt")
        #targetlist = list()
        #targetList = [line.rstrip() for line in open("mine.txt")]
        contentlist = file.read().split(" ")
        string=input("search box").split(" ")
        print(string)
        fre={}
        outputfile=open("outputfile.txt",'w')
        for word in contentlist:
            print(word)
            for i in string:
               # print(i)
                if i == word:
                    print(f"'{string}' is in text file ")
                    outputfile.write(word)
                    print(word)

                    spl=tuple(string.split())
                    for j in range(0,len(contentist)):

                        if spl in contentlist:
                            fre[spl]+=1 
                        else:
                            fre[spl]=1   
                        sor_list=sorted(fre.items(),key =lambda x:x[1])
                        for x,y in sor_list:
                            print(f"Word\tFrequency")
                            print(f"{x}\t{y}")
            else:
                continue

        print(f"The word or collection of word is not present")
    search_tand_export()

```