I tried this code:
import threading
def hello(arg, kargs):
print(arg)
t = threading.Timer(2, hello, "bb")
t.start()
while 1:
pass
The output is just b
.
How can I pass arguments to the callback properly?
If I remove the kargs
parameter from hello
, I get an exception that says TypeError: hello() takes 1 positional argument but 2 were given
. Why? Where did the kargs
value come from in the first code?