Documentation? file/open with tea

Eric Pederson whereU at now.com
Sun Sep 19 15:40:37 EDT 2004


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=open(somefile, 'at')
f2=open(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'?

Also, is this still a valid mode going forward, or has it been deprecated?


TIA



>>> f=open("C:\somepath\All_domain_suffixes.txt",'rt')
>>> f.read()
'\xa0.ac \xa0|\n\xa0.ad \xa0|\n\xa0.ae \xa0|\n\xa0.aero \xa0|\n\xa0.af \xa0|\n\xa0.ag \xa0|\n\xa0.ai \xa0|\n\xa0.al \xa0|\n\xa0.am \xa0|\n\xa0.an \xa0|\n\xa0.ao \xa0|\n\xa0.aq \xa0|\n\xa0.ar \xa0|
[... etc.]


Eric
:::::::::::::::::::::::::::::::::::
domainNot="@something.com"
domainIs=domainNot.replace("s","z")
ePrefix="".join([chr(ord(x)+1) for x in "do"])
mailMeAt=ePrefix+domainIs
:::::::::::::::::::::::::::::::::::



More information about the Python-list mailing list