import datetime import time def test(day=datetime.datetime.now()): print day while True: test() time.sleep(1) run result: 2015-06-05 16:52:47.106000 2015-06-05 16:52:47.106000 2015-06-05 16:52:47.106000 2015-06-05 16:52:47.106000 2015-06-05 16:52:47.106000 2015-06-05 16:52:47.106000 2015-06-05 16:52:47.106000 2015-06-05 16:52:47.106000