If I want to remove line breaks from a text file such as this:
hello
there
and I use a simple code like this:
with open('words.txt') as text:
for line in text:
print (line.strip())
It outputs this:
hello
there
However, I want my code to output this:
hello
there
How can I do this? Thanks in advance.