Python Forum
this is inconsitent with documentation
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
this is inconsitent with documentation
#1
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>
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
There is no %f formater for time.strftime().

https://docs.python.org/2/library/time.h...e.strftime
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#3
(Jan-16-2017, 06:17 AM)wavic Wrote: There is no %f formater for time.strftime().

https://docs.python.org/2/library/time.h...e.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.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#4
what exactly is inconsistent with documentation? The output is from two different dates, at different times of the day
Reply
#5
If you want it as a number, use time.time().
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020