Reputation: 13
I started learning Python from CodeAcademy, and I realized right away that the course was outdated. I continued the course with VisualStudio open in case I wanted to make sure something didn't change. However, I tried making a very simple program that outputs the date in VisualStudio and it's not doing anything.
from datetime import datetime
now = datetime.now
print(now.second)
When I run this in the VisualStudio environment, it throws the error:
AttributeError: 'builtin_function_or_method' object has no attribute 'second'
When only seconds ago I had done it in CodeAcademy. I have done my fair share of googling and found nobody who has come across the same issue.
Upvotes: 0
Views: 51
Reputation: 8378
now
is a function (technically a class method) so call it like this: print(now().second)
Upvotes: 2