Date time grand finale


#1

File "python", line 6
print (12/31/2001 15:29:29)
^
Syntax Error: invalid syntax
what should I do I did every thing they told me.


Date and Time | Grand Finale
#2

Can you post your full code? So we can see what is causing the error


#3

Here is my code
from datetime import datetimenow = datetime.now()
print ('%s / %s / %s %s : %s : %s') % (now.month, now.day, now.year, now.hour, now.minute, now.second)
print datetime.now()

It says File "python", line 1
from datetime import datetimenow = datetime.now()
^
SyntaxError: invalid syntax
What is wrong with this?
Please help. Thank you


#4

you can't import and declare a variable on the same line


#5

in line 1 its should be only:
from datetime import datetime
line 2 follows with:
now = datetime.now()

Goodluck :wink:


#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.