test.py
import threading
def hi():
print 'hello world'
t1 = threading.Thread(target=hi)
t2 = threading.Thread(target=hi)
t1.start()
t2.start()
错误消息:
Exception in thread Thread-2:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
TypeError: 'Thread' object is not callable