How do you read a loop file in Python?

Duyên Trương

New member
How do you read a loop file in Python?
Answer
It is possible to read a file line by line using for loop. To do that, first, open the file
using Python open() function in read mode. The open() function will return a file handler. Use the file handler inside your for-loop and read all the lines from the given file line by line.
 

Tìm kiếm

Back
Top