python线程是不可调用的错误

时间:2016-04-29 17:40:09

标签: python multithreading

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

0 个答案:

没有答案