from datetime import datetime import time now = datetime.now() while True: print(now.strftime("local time :- %X")) time.sleep(2)