How to get millisec/fractional seconds out of a time object ?
David
David
Tue Jan 6 16:34:03 EST 2009
Thanks for help to a beginner.
script23
import time
import datetime
start_time = datetime.datetime.now()
time.sleep(0.14)
end_time = datetime.datetime.now()
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