擅长:python、mysql、java
<p>请注意结果上的差异,这取决于“time.sleep”是输入还是输出</p>
<pre><code>import time
from multiprocessing import Pool
def process(x):
print(x)
def main():
pool = Pool(4)
pool.imap_unordered(process, (1,2,3,4,5))
pool.close()
#time.sleep(3)
if __name__ == "__main__":
main()
</code></pre>