Python reads the file, skips spaces, and stores the words of each line in a List:
Code:
f = open("doc_1_Windex.txt","r", encoding='utf-8') lines = f.readlines()#read all content for i in range(0,lines.__len__(),1): #(start/left boundary, end/right boundary, step) list = [] ## empty list, store the i-th row data in the list for word in lines[i].split(): word=word.strip(string.whitespace) list.append(word); print(list)