I am new to thread, I had encountered abnormal result while printing the value inside a list using thread to allow 2 functions to working at the same time and appending the result to a list. Below my code:
import threading
def func1():
return "HTML"
def func2():
return "IS FUN"
threadslist = []
thread1 = threading.Thread(target=func1)
thread2 = threading.Thread(target=func2)
x = thread1
y = thread2
x.start()
y.start()
threadslist.append(x)
threadslist.append(y)
print(threadslist)
And here is the result for the list:
[<Thread(Thread-1, stopped 1076)>, <Thread(Thread-2, stopped 7948)>]
Why it storing the Threads object instead of storing ['HTML', 'IS FUN'] ?