Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5217

Python • Re: Datetime Code Not Working

$
0
0
It doesn't matter, because, it's really just incorporating the date in the name, and I found out why it didn't work. I should have instead of making current_time a variable, I should have defined it like this:

Code:

#what is was:current_time = datetime.datetime.now()#what it is now:def current_time():return datetime.now()#I also replaced import datetime to: from datetime import datetime
Once I changed that, it worked.

Statistics: Posted by Henrik Gill — Mon Mar 18, 2024 8:40 pm



Viewing all articles
Browse latest Browse all 5217

Trending Articles