Python Forum
this is inconsitent with documentation - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: this is inconsitent with documentation (/thread-1607.html)



this is inconsitent with documentation - Skaperen - Jan-16-2017

the strftime() method has a single common documentation for the two modules (datetime and time) it is found in, but ...
Output:
lt1/forums /home/forums 1> py3 Python 3.5.2 (default, Nov 17 2016, 17:05:23) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import datetime,time >>> datetime.datetime.now().strftime('%f') '754235' >>> time.strftime('%S%f') '26%f' >>> lt1/forums /home/forums 2> py2 Python 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import datetime,time >>> datetime.datetime.now().strftime('%f') '390678' >>> time.strftime('%S%f') '02%f' >>> lt1/forums /home/forums 3>



RE: this is inconsitent with documentation - wavic - Jan-16-2017

There is no %f formater for time.strftime().

https://docs.python.org/2/library/time.html#time.strftime


RE: this is inconsitent with documentation - Skaperen - Jan-16-2017

(Jan-16-2017, 06:17 AM)wavic Wrote: There is no %f formater for time.strftime().

https://docs.python.org/2/library/time.html#time.strftime

the pdf docs document both in the same place, which implies that both are the same whether they have %f (defined by posix) or not. it doesn't really say for sure, but it provides the posix table, implying by that, that we can expect posix stuff to work.

it would be nice if python worked with nanoseconds.  but the layer below it (still) does a poor job.


RE: this is inconsitent with documentation - buran - Jan-16-2017

what exactly is inconsistent with documentation? The output is from two different dates, at different times of the day


RE: this is inconsitent with documentation - ichabod801 - Jan-16-2017

If you want it as a number, use time.time().