Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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)
 
PREVIOUS NEXT
Tagged: #line #text #file #list #Python
ADD COMMENT
Topic
Name
9+1 =