> >>> os.linesep > '\012' os.linesep is \015\012 on Windows. I seem to have found the real problem: readline()/readlines() returns the string(s) with only \012 on it, not both or none. I guess it's because DOS/Win use two bytes not one like Unix/Mac for EOL, making EOL a tad harder since it requires peeking ahead a byte to see if it's \012 or not.