how would you Read a file into a list of words return that l
how would you Read a file into a list of words, return that list in python
 it statrs with
 def read_list(fileText.txt):
    
Solution
def read_list(fileText.txt):
 file_open = open(list_file,\'r\')
 list_word=[]
 data= file_open.readlines()
 for n in range(len(data)):
 list_word.extend(data[n].split())
 return list_word
 file_open.close()
Here we need to read file fileText.tst
 Then we opened the file in read mode.Creating a list named list_word which will hold words from the file.
 data will hold the contents of files line by line and then we iterate through it for each word and store in list and then return the list which holds the list of words.

