If you are operating on a file that you opened in text mode, then you are correct that line breaks all show up as '\n'. Otherwise, you are looking for os.linesep .
The string used to separate (or, rather, terminate) lines on the
current platform. This may be a single
character, such as '\n' for POSIX, or
multiple characters, for example,
'\r\n' for Windows. Do not use
os.linesep as a line terminator when
writing files opened in text mode (the
default); use a single '\n' instead,
on all platforms.
If specify test resp. binary properly when opening files, and use universal newlines, you shouldn't have to worry about different newlines most of the time.