I want to read a file and remove the spaces. I swear I've done this multiple times, but some reason the method I used to use doesn;t seem to be working. I must be making some small mistake somewhere, so I decided to make a small practice file (because the files I actually need to use are EXTREMELY LARGE) to find out.
the original file says:
abcdefg (new line) hijklmn
but I want it to say: abcdefghijklmn
file = open('please work.txt', 'r')
for line in file:
lines = line.strip()
print(lines)
close.file()
However, it just says: abcdefg (new line) hijklmn
and when I use line.strip('\n') it says: abcdefg (big new line) hijklmn
Any help will be greatly appreciated, because this was the first thing I learned and suddenly I can't remember how to use it!