Question: how to convert a text file to list in python?
Answer: a_file = open("sample.txt", "r")
list_of_lists = []
for line in a_file:
stripped_line = line. strip()
line_list = stripped_line. split()
list_of_lists. append(line_list)
a_file. close()
print(list_of_lists)