Hey everybody, I am using 2.7 on Ubuntu 12.10. All I need to do is to print time with the microseconds. I have been looking at the docs and trying things for about half a day now with no success. Currently my code looks like this:
# write date and time and microseocnds self.logfile.write('%s\t'%(str(strftime("%Y-%m-%d", )))) self.logfile.write('%s\t'%(str(strftime("%H:%M:%S", )))) self.logfile.write('%s\t'%(str(time()))) the output looks like this: 2013-08-02 06:01:43 00:00:00 2013-08-02 06:01:43 00:00:00 2013-08-02 06:01:43 00:00:00 2013-08-02 06:01:43 00:00:00 2013-08-02 06:01:43 00:00:00 2013-08-02 06:01:43 00:00:00 2013-08-02 06:01:43 00:00:00 2013-08-02 06:01:43 00:00:00 2013-08-02 06:01:43 00:00:00 2013-08-02 06:01:44 00:00:00 2013-08-02 06:01:44 00:00:00 as you can see in the 2nd column the observations occur with 'fractional second' frequency, up to 8 or 9 per second. You can also see my latest attempt to get the microseconds in the third column is not working. It would really be great if python had a way to just tack the microseconds (actually i think milliseconds would be better) on to the second (in the 2nd column) as a fraction. If this is not possible I need the extra write statement for just the microseconds (millisecond if possible). Any help will be much appreciated. Thanks! -- http://mail.python.org/mailman/listinfo/python-list