Just pass empty string to end parameter in print
function after strippping off the newline character.
print (line, end = "")
print
by default print the content in a new line for each iteration but by passing empty string to the end
parameter, this default behaviour won’t work. If you failed to remove the newline character, it would print the content along with the newline character.
2
solved How to concatenate a string in python?