1from datetime import datetime
2import time
3now = datetime.now()
4while True:
5 print(now.strftime("local time :- %X"))
6 time.sleep(2)
1import datetime
2datetime.datetime.now()
3datetime.datetime(2009, 1, 6, 15, 8, 24, 78915)
4
5print(datetime.datetime.now())
6#2009-01-06 15:08:24.789150