get line and next line python text fi;e code example
Example 1: write lines python with line breaks
fw.write('\n'.join(line_list) + '\n')
Example 2: python read text file next line
filepath = 'Iliad.txt'
with open(filepath) as fp:
line = fp.readline()
cnt = 1
while line:
print("Line {}: {}".format(cnt, line.strip()))
line = fp.readline()
cnt += 1