I'm using PyCharm Community 2019.1.4 (July 2019) and Python version 3.7.4, July 8, 2019.
My system is has 32GB RAM and an i9900 CPU running Windows 10 Pro (not sure if any of this matters but don't want someone to ask).
I'm teaching myself Python using the "Python in Easy Steps" book by Mike McGrath. I've had one or two programs that had minor errors and a Google search helped me fix the issues. The program I'm having difficulty with now is as follows (I'm copying the example code exactly as provided:
In advance - thank you!
Nick.
My system is has 32GB RAM and an i9900 CPU running Windows 10 Pro (not sure if any of this matters but don't want someone to ask).
I'm teaching myself Python using the "Python in Easy Steps" book by Mike McGrath. I've had one or two programs that had minor errors and a Google search helped me fix the issues. The program I'm having difficulty with now is as follows (I'm copying the example code exactly as provided:
from datetime import * today = datetime.today() print('Today is:', today) for attr in \ ['year','month','day','hour','minute','second','microsecond']: print('Time:', today.hour,':', today.minute, sep='') day = today.strftime('%A') month = today.strftime('%B') print('Date:',day, month, today.day)If I only run 'from datetime import *', I get no error so that in itself is not the issue; however, once I add any code such as only the second line, I get the following errors:
Error:Traceback (most recent call last):
File "C:/Users/Dr. Nicholas Shaw/PycharmProjects/Practice_2/venv/datetime.py", line 1, in <module>
from datetime import *
File "C:\Users\Dr. Nicholas Shaw\PycharmProjects\Practice_2\venv\datetime.py", line 3, in <module>
today = datetime.today()
NameError: name 'datetime' is not defined
Process finished with exit code 1
I've tried different solutions based upon code found through Google searches such as the 3 line program found here: https://www.w3schools.com/python/python_datetime.asp. No matter what I do - same errors. I reviewed what is included in 'datetime' to make sure that the version of Python I'm using has these functions - they do.In advance - thank you!
Nick.