0

please tell me how to make sure that the function printit () is executed every second?

import threading

def printit():
    print("Hello, World!")    

threading.Timer(1.0, printit).start()

the problem is that the 'hello world' appears only once

Sergey
  • 869
  • 2
  • 13
  • 22

1 Answers1

2

How about

import time
while True:
    time.sleep(1)
    print ('Hello world')
user590028
  • 11,364
  • 3
  • 40
  • 57