Make the readline method of Python recognize both end-of-line variations?
<p>I am writing a Python file that needs to read in several files of different types.  I am reading the files in line by line with the traditional <code>for line in f</code> after using <code>f = open("file.txt", "r")</code>.</p>

<p>This doesn't seem to be working for all files.  My guess is some files end with different encodings (such as \r\n versus just \r).  I can read the whole file in and do a string split on \r, but that is hugely costly and I'd rather not.  Is there a way to make the readline method of Python recognize both end-of-line variations?</p>
