parse date/time from a log entry with only strftime (and no regexen)

andrew cooke andrew at acooke.org
Tue Feb 3 17:47:40 EST 2009


> > ValueError: unconverted data remains:  this is the remainder of the log  
> > line
> > that I do not care about

you could catch the ValueError and split at the ':' in the .args
attribute to find the extra data.  you could then find the extra data
in the original string, use the index to remove it, and re-parse the
time.

ugly, but should work.
andrew



More information about the Python-list mailing list