有谁知道我如何在不使用全局变量的情况下在此代码中将变量(或获取变量)从 threadOne 发送到 threadTwo?如果没有,我将如何操作全局变量?只是在两个类之前定义它并在 run 函数中使用全局定义?
import threading
print "Press Escape to Quit"
class threadOne(threading.Thread): #I don't understand this or the next line
def run(self):
setup()
def setup():
print 'hello world - this is threadOne'
class threadTwo(threading.Thread):
def run(self):
print 'ran'
threadOne().start()
threadTwo().start()
谢谢