How to read a file without newlines?

In Python, calling e.g. temp = open(filename,'r').readlines() results in a list in which each element is a line from the file. However, these strings have a newline character at the end, which I don't want.

How can I get the data without the newlines?

← Назад к списку