I currently have test.txt
1234 5678
I want to print each line without a new line char "\ n"
file=open("test.txt","r") lines = file.readlines() for i in lines: print i[:-1]
this will delete \ n for the first line, but for the second line: 5678 , 8 will be disabled because there will be no \n after it. What is a good way to handle this correctly?
source share