Re: Need Help Parsing From File




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.
f = open('foo.txt', 'rt')
f = open('foo.txt', 'rs')
f = open('foo.txt', 'ratsdroppings')
# Nary an exception raised, not the slightest murmur

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

.



Relevant Pages

  • Re: Differences between const char and char
    ... > Ben Pfaff wrote: ... > accurate name for the new ANSI standard. ... Which is: ISO/IEC/INCITS ...
    (comp.lang.c)
  • Re: CreateFile and MAX_PATH and UNICODE
    ... name is limited to MAX_PATH characters. ... The fact is that in the ANSI version of this function, the name is limited to MAX_PATH _bytes_ not characters. ... Microsoft replied with an assertion that I had a misunderstanding and an assertion that in ANSI every character is a single byte. ... I think that Windows Explorer calls Unicode APIs, but still, Windows Explorer is a program with its own limitation. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: ANSI C compliance
    ... The 1989 ANSI standard was adopted, ... >ANSI is a member if ISO.) ... fine folks here) uses "ISO" to refer to the standard. ...
    (comp.lang.c)
  • Re: Has ANSI Approved ISO/IEC 9899:1999?
    ... A Google search shows arguably confusing answers as to whether ANSI ... it says that "It was adopted as an ANSI standard in March 2000." ... members, with time for review, comments, and finally a vote. ...
    (comp.lang.c)
  • Re: Update header column to match its detail values.
    ... > Hmmm, I don't think I know of any one place where this all is documented ... > (other than the ANSI standard itself, ... > I picked up most of my knowledge about ANSI vs T-SQL by reading ... BOL gives some hints about this too. ...
    (microsoft.public.sqlserver.programming)