2

我有两个课程:class RemeshTweenOnce(object):class RemeshOnce(object):

稍后在程序中,我有一个连续调用两者的函数:

RemesherTweenOnce()

RemeshOnce()

我怎样才能同时运行这两个?我觉得这可能是一个简单的解决方法,但对 Python 来说非常陌生,并且对文档有点迷失。

4

1 回答 1

3
from multiprocessing import Process

def fun1():
    RemesherTweenOnce()

def fun2():
    RemesherOnce()

p1 = Process(target=fun1)
p2 = Process(target=fun2)

# Starts processes.
p1.start()
p2.start()

# If you would like to wait for the results.
p1.join()
p2.join()
于 2013-07-29T19:59:44.237 回答