Re: Need Help Parsing From File
- From: "John Machin" <sjmachin@xxxxxxxxxxx>
- Date: 7 Dec 2006 10:44:47 -0800
Gabriel Genellina wrote:
At Thursday 7/12/2006 02:51, John Machin wrote:
Gabriel Genellina wrote:
ftxt=open(filename,"rt")
Never seen that done before. It's not in the docs.
A remnant of my MSDOS+C background...
FWIW:
Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit
(Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
# Nary an exception raised, not the slightest murmurf = open('foo.txt', 'rt')
f = open('foo.txt', 'rs')
f = open('foo.txt', 'ratsdroppings')
Is this a bug or a feature? Or is it one of those good old "unspecified
behaviour" cases? MSVC rtl only?
The Python docs say only that the initial letter is checked. And the
ANSI 89 C says that other characters may follow after r, r+, etc.
"rt" is useless for an ANSI C compiler, since the default stream mode
is "text" -on systems which differentiate between text and binary-
and irrelevant on systems which don't do such distinction.
(And since I got used to write "rt",
Why did you do that?
(1) Text mode is was and ever shall be the default, even with MS.
(2) Seeing we're referring to docs and standards: Microsoft C 5.0
Optimizing Compiler, Run-Time Library Reference manual says "The t
option is not part of the ANSI standard for open, but is a Microsoft
extension and should not be used where ANSI portability is required".
you can infer something about
*when* I began to write C programs...)
Youngster :-)
Cheers,
John
.
- Follow-Ups:
- Re: Need Help Parsing From File
- From: Gabriel Genellina
- Re: Need Help Parsing From File
- References:
- Need Help Parsing From File
- From: John Frame
- Re: Need Help Parsing From File
- From: Gabriel Genellina
- Re: Need Help Parsing From File
- From: John Machin
- Re: Need Help Parsing From File
- From: Gabriel Genellina
- Need Help Parsing From File
- Prev by Date: Re: how to delete matplotlib data between ploting
- Next by Date: feed-forward neural network for python
- Previous by thread: Re: Need Help Parsing From File
- Next by thread: Re: Need Help Parsing From File
- Index(es):
Relevant Pages
|