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

David David
Tue Jan 6 22:34:03 CET 2009

Thanks for help to a beginner.

        import time
        import datetime
        start_time =
        end_time =
        datetime.timedelta = end_time - start_time
        print(datetime.timedelta)    #  works, prints 0:00:0.141000
        print(datetime.timedelta.seconds)    #  prints 0
        print(datetime.timedelta.milliseconds)  # fails 
                              < object has no attribute milliseconds >

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

More information about the Python-list mailing list