python code to rempve newlines from text file code example
Example: Python program to remove newline characters from a file
with open('file1.txt','r+') as f:
line = f.readlines()
print(line)
[print(l.strip()) for l in line]
with open('file1.txt','r+') as f:
line = f.readlines()
print(line)
[print(l.strip()) for l in line]