python converting the contents of a file to list once u read it in code example
Example 1: each line in a text file into a list in Python
with open('file1.txt','r') as f:
listl=[]
for line in f:
strip_lines=line.strip()
listli=strip_lines.split()
print(listli)
m=listl.append(listli)
print(listl)
Example 2: read file into list python
with open('file1.txt','r+') as f:
lines=f.read().splitlines()
print(lines)