Documentation? file/open with tea

exarkun at divmod.com exarkun at divmod.com
Sun Sep 19 21:47:04 CEST 2004


On Sun, 19 Sep 2004 11:40:37 -0800, "Eric Pederson" <whereU at now.com> wrote:
>WryPyY's-
> 
> I've come across this file operation in others' code and have not seen any =
> documentation for it: the use of "t" in the mode of file opening, such as:
> 
> f1=3Dopen(somefile, 'at')
> f2=3Dopen(otherfile, 'rt')
> 
> [to be clear, I am talking about 't' tea, not '+' plus]
> 
> Is this merely another shorthand for a binary mode, or is there more going =
> on with 't'?

  't' is the opposite of 'b'.  It's short for "text".  It is also the default, so the above could be rewritten as open(somefile, 'a') or open(otherfile, 'r') with no change in meaning.

  Jp



More information about the Python-list mailing list