Answers for "python read file into list of lines"

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)
Posted by: Guest on December-03-2020
-3

python read file into a list

f = open(filename, "r")
   listItems = f.read().splitlines()
Posted by: Guest on April-01-2020

Code answers related to "python read file into list of lines"

Python Answers by Framework

Browse Popular Code Answers by Language