Helpful Information
 
 
Category: Python Programming
Strange problem

Why does this work in the "Python Shell" but when I execute it in a script it doesn't work?

day = time.strftime('%d', time.gmtime(time.time()))

When I execute this in a script i get this error:

Traceback(most recent call last):
File "Myfile.py"
day = time.strftime('%d', time.gmtime(time.time()))
AttributeError: strftime

Seems a bit unlogical for me. Can someone help me?

It appears that you have to many close-parentheses at the end of the line. If that's just a typo in you post then nevermind, but you may want to check on that.

Problem already solved. Thanks.










privacy (GDPR)