グローバル変数を使用せずに、このコードで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()
ありがとう