1# name.txt
2david
3mary
4john
5
6
7with open('names.txt', 'r') as f:
8 myNames = [line.strip() for line in f]
9
10# Result
11
12['david','mary','john']
1with open('file1.txt','r') as f:
2 listl=[]
3 for line in f:
4 strip_lines=line.strip()
5 listli=strip_lines.split()
6 print(listli)
7 m=listl.append(listli)
8 print(listl)