时间:2021-07-01 10:21:17 帮助过:128人阅读
multipressing模块是python 2.6版本加入的,通过这个模块可以轻松实现异步调用
from multiprocessing import Pool def f(x): return x*x if __name__ == '__main__': pool = Pool(processes=1) # Start a worker processes. result = pool.apply_async(f, [10], callback) # Evaluate "f(10)" asynchronously calling callback when finished.
希望本文所述对大家的Python程序设计有所帮助。