-3
>>>import datetime
>>>now = datetime.datetime.now()
>>>print ("Current date and time : ") 
>>>print (now.strftime("%Y-%m-%d %H:%N:%S"))```

Error:

error: >>>import datetime
       ^
sshashank124
  • 31,495
  • 9
  • 67
  • 76
MHD
  • 3
  • 1
  • 2
    You should not paste an interpreter session into a .py file, would be my guess. `>>>` is the interactive prompt, it's **not** valid Python code. – jonrsharpe Jan 19 '20 at 11:32

1 Answers1

0

it seems like that you have copied code from an interpreter or a book to a file and tried to run it with python command. if you want to do so you need to remove >>> from lines and run again.

saeed foroughi
  • 1,662
  • 1
  • 13
  • 25