Aw: Re: stuck on time
RobH
rob at despammer.com
Sun Dec 8 13:47:21 EST 2019
On 08/12/2019 16:49, Dennis Lee Bieber wrote:
> On Sun, 8 Dec 2019 09:44:54 +0000, RobH <rob at despammer.com> declaimed the
> following:
>
>> def print_time():
>> current_time = time.strftime("%I:%M")
>>
>> returns nothing.
>>
> So what did you expect it to do?
>
> All that does is define a function (binding the name "print_time" to a
> compiled function object), and that function itself returns nothing IF
> invoked (you haven't invoked it). (Presuming time has been imported, the
> function will bind the name "current_time" to a string representation of
> the current time... and then throws away "current_time" when the function
> falls off the end and returns to the caller.)
>
>> I don't know if that is the correct way as I am just using the code from
>> the project I am trying to do
>
> This is showing a severe lack of understanding in how Python itself
> operates, leading me to recommend rereading a Python tutorial book before
> attempting to hack into some one else's code.
>
>
Err, excuse me, I was not attempting to hack into someone else's code.
As the code is in the public domain, I wanted it to work as is, like it
did for the author, without changing anything.
So why should I now start to learn how python works.
If the code doesn't work for me after a fair trial, I'll move on to
something else.
More information about the Python-list
mailing list