mx.DateTime.Parser.DateFromString('crap')

Koczian Sibylle.Koczian at Bibliothek.Uni-Augsburg.de
Thu Jul 10 14:51:13 CEST 2003


This doesn't raise an exception but returns the current date. I know the 
comment in the notes for the Parser submodule: "The Parser submodule ... 
will try very hard to come up with a reasonable output given a valid 
input." But this is no valid input, so I'd prefer an exception or at 
least not a valid DateTime object.

I've got to parse a file where some lines contain months in the form 
"Jul 2003", lots of lines contain no date at all (DateFromString returns 
the current date again), and the first line with something that's 
neither empty nor a valid month should end the processing.

Working on Windows I haven't got strptime.

No better way than checking explicitly for the content of the last line?

Thanks for any help,
Koczian

-- 
Dr. Sibylle Koczian
Universitaetsbibliothek, Abt. Naturwiss.
D-86135 Augsburg

Tel.: (0821) 598-2400, Fax : (0821) 598-2410
e-mail : Sibylle.Koczian at Bibliothek.Uni-Augsburg.DE





More information about the Python-list mailing list