Newline at EOF Removal

Tim Peters tim.peters at
Mon Jan 9 09:48:01 EST 2006

[Bengt Richter]
> ...
> [1] BTW, I didn't see the 't' mode in
> description of open/file, but I have a nagging doubt about saying it's not valid.
> Where did you see it?

't' is a Windows-specific extension to standard C's file modes. 
Python passes mode strings as-is on to the platform C library, so if
your platform C likes 't', you're free to use it.

You might think there's no point to passing 't', since text mode is
the default.  If so, you'd almost be right ;-).  The rub is that
Windows also supports another non-standard gimmick, to make binary
mode the global default instead (although very few know about this,
and I've never seen it used in real life).  If you've done that, then
't' is necessary to get text mode.

More information about the Python-list mailing list