how to strip new line from a file in python 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]