You are removing the newline characters “\n” from each line in the file with the statement:-
line=line.strip()
Just remove it and it should work correctly.
solved Python output on a separate lines
You are removing the newline characters “\n” from each line in the file with the statement:-
line=line.strip()
Just remove it and it should work correctly.
solved Python output on a separate lines