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
Post a Comment