In article ,
Skip Montanaro wrote:
> When Tim Peters wrote datetime, the world became a better
> place.
Lots of languages and databases have things called datetimes. It's easy
to be lulled into thinking that they're all the same, but they're not.
They all have slightly different ranges an
> i did:
>
>from time import strftime, time
>from datetime import datetime
>
>now = datetime.now()
>
>self.logfile.write('%s\t'%(strftime("%Y-%m-%d",)))
>self.logfile.write('%s\t'%(now.strftime("%H:%M:%S.%f",)))
Note that you don't need the time module here. Datetime objects h
>
> Taking a step back, you're probably better off using datetimes. You'll
>
> get all this conversion nonsense for free:
>
i did:
from time import strftime, time
from datetime import datetime
now = datetime.now()
self.logfile.write('%s\t'%(strftime("%Y-%m-%d",)))
self.logf
Am 02.08.2013 15:17, schrieb matt.doolittl...@gmail.com:
so you are saying that
self.logfile.write('%s\t'%(str(time(
should be:
self.logfile.write('%s\t'%(str(time.time(
No, I'm not saying that. What I wanted to make clear is that your code
is impossible to understand as it
In article <07f6b1c7-069d-458b-a9fe-ff30c09f2...@googlegroups.com>,
matt.doolittl...@gmail.com wrote:
> self.logfile.write('%s\t'%(str(time(
> [...]
> 1375588774.89
> [...]
> Why is it only giving me the centisecond precision? the docs say i should
> get microsecond precision
When citing d
matt.doolittl...@gmail.com wrote:
> ok so now i import the module like this:
>
>from time import strftime, time
>
> i made the write statement like this:
>
>self.logfile.write('%s\t'%(str(strftime("%Y-%m-%d",
>self.logfile.write('%s\t'%(str(strftime("%H:%M:%S",
>self.logf
matt.doolittl...@gmail.com writes:
>self.logfile.write('%s\t'%(str(time(
[...]
> 2013-08-0323:59:341375588774.89
[...]
> Why is it only giving me the centisecond precision? the docs say i
> should get microsecond precision with the code i put together.
Because of str()'s defau
ok so now i import the module like this:
from time import strftime, time
i made the write statement like this:
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(
(oh and btw,i kno
> is the third column is only the microsecond?
Yes.
> how could i get this to write with the rest of the time (the hh:mm:ss) ?
It sounds like you really want the time formatted in a particular way,
not just the numeric value of one or more fields. Look at the
documentation for the strftime meth
On Friday, August 2, 2013 8:35:13 AM UTC-4, Steven D'Aprano wrote:
> On Fri, 02 Aug 2013 03:54:32 -0700, matt.doolittle33 wrote:
>
>
>
> > 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 do
On Friday, August 2, 2013 8:37:45 AM UTC-4, Skip Montanaro wrote:
> Perhaps use datetime?
>
>
>
> >>> now = datetime.datetime.now()
>
> >>> now.isoformat()
>
> '2013-08-02T07:37:08.430131'
>
> >>> now.strftime("%f")
>
> '430131'
>
>
>
> Skip
Thanks Skip, what i currently i have is:
so you are saying that
self.logfile.write('%s\t'%(str(time(
should be:
self.logfile.write('%s\t'%(str(time.time(
???
Thanks
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, Aug 2, 2013 at 1:08 PM, Dave Angel wrote:
> matt.doolittl...@gmail.com wrote:
>
>> Hey everybody,
>>
>> I am using 2.7 on Ubuntu 12.10.
>
> and what version of Python are you using? I don't know if it matters,
> but it's useful to always supply both Python version and OS version.
>
Looks
On Fri, 02 Aug 2013 03:54:32 -0700, matt.doolittle33 wrote:
> 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
Perhaps use datetime?
>>> now = datetime.datetime.now()
>>> now.isoformat()
'2013-08-02T07:37:08.430131'
>>> now.strftime("%f")
'430131'
Skip
--
http://mail.python.org/mailman/listinfo/python-list
Am 02.08.2013 12:54, schrieb matt.doolittl...@gmail.com:
I am using 2.7 on Ubuntu 12.10. All I need to do is to print time with the
microseconds.[...]
# write date and time and microseocnds
self.logfile.write('%s\t'%(str(strftime("%Y-%m-%d",
self.logfile.write(
matt.doolittl...@gmail.com wrote:
> Hey everybody,
>
> I am using 2.7 on Ubuntu 12.10.
and what version of Python are you using? I don't know if it matters,
but it's useful to always supply both Python version and OS version.
> All I need to do is to print time with the microseconds. I have b
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.
18 matches
Mail list logo