TypeError: unorderable types: function() < int()

Chris Angelico rosuav at gmail.com
Tue May 10 08:31:00 EDT 2016


On Tue, May 10, 2016 at 10:19 PM, Dennis Lee Bieber
<wlfraed at ix.netcom.com> wrote:
>         You invoke strftime() [in default: use current time mode], but pass it
> a format that is not defined in the documentation (or wasn't in Python 2.7
> which I'm still running).       #2
>  %s (lowercase) formats the seconds field of the time of day. And worst,
> since you don't return the result, it just gets thrown away.    #3
>

Sorry to nitpick, but this isn't the case. time.strftime("%S") is what
you're talking about (getting the "seconds since beginning of current
minute"). There is a "%s" format string, but it's not supported on all
platforms; it actually would be more useful here, as it represents the
time as seconds since 1970 (aka "Unix time").

Of course, time.time() would still be far more useful here, as you
subsequently recommended.

ChrisA



More information about the Python-list mailing list