I have to evaluate a text file that contains a poorly formatted essay that I must reformat. The first step is to remove all extra spaces in the sentences. I decided to read in the file and then put all the lines into a string and then I put the lines that contains sentences into its own separate list. Now I have trouble with deciding how to remove the extra spaces in the list and was wondering if theres a built in method that I can use to remove extra spaces?
Here is an example of a sentence in my list:
["Albuquerque is my     turkey and he's   feathered and    he's      fine, And    he"]
and the code I have so far :
def remove_extra_whitespaces():
    fileList= []
    removeList= []
    infile= open("essay1.txt", 'r')
    for line in infile:
        if (len(line))>0:
            fileList.append(line.strip())
        else:
            fileList.append(line)
    print (len(fileList[4]))
    for k in range(len(fileList)):
        if (len(fileList[k]))>0:
            #" ".join(fileList[k])
            removeList.append(fileList[k])
 
    