time - Using %f with strftime() in Python to get microseconds -



time - Using %f with strftime() in Python to get microseconds -

i'm trying utilize strftime() microsecond precision, seems possible using %f (as stated here). when seek next code:

import time import strftime time print strftime("%h:%m:%s.%f")

...i hour, minutes , seconds, %f prints %f, no sign of microseconds. i'm running python 2.6.5 on ubuntu, should fine , %f should supported (it's supported 2.6 , above, far know.)

you can utilize datetime's strftime function this. problem time's strftime accepts timetuple not carry microsecond information.

datetime.datetime.now().strftime("%h:%m:%s.%f")

should trick!

python time strftime

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -