How to get millisec/fractional seconds out of a time object ?

Scott David Daniels Scott.Daniels at Acm.Org
Tue Jan 6 16:44:31 EST 2009


David Lemper wrote:
> Thanks for help to a beginner.
> 
> script23
>         ...
>         datetime.timedelta = end_time - start_time
This is a bad idea.  You are changing the globals of another module.
You are lucky you didn't break anything.
Better would be:
           elapsed = end_time - start_time
then use things like:
           print elapsed
           print elapsed.seconds

>...    How do I get the 0.141000 out of that or any time object ?
>    On line docs are arcane to a novice.

Try this:
     print dir(elapsed)
The answer should become obvious.

--Scott David Daniels
Scott.Daniels at Acm.Org




More information about the Python-list mailing list