for line in file: line = line.replace('\n','') code example
Example: python read file without newline
# converts read file into a list without newlines
temp = file.read().splitlines()
# converts read file into a list without newlines
temp = file.read().splitlines()