11/07/2022

python text read line by line

 refer to code

..

fn = './text.txt'
# Using readlines()
with open(fn, 'r') as fp:
Lines = fp.readlines()
count = 0
for line in Lines:
count += 1
print("{}: {}".format(count, line.strip()))

..


Thank you.

www.marearts.com