• <tfoot id='cE6PZ'></tfoot>

      <i id='cE6PZ'><tr id='cE6PZ'><dt id='cE6PZ'><q id='cE6PZ'><span id='cE6PZ'><b id='cE6PZ'><form id='cE6PZ'><ins id='cE6PZ'></ins><ul id='cE6PZ'></ul><sub id='cE6PZ'></sub></form><legend id='cE6PZ'></legend><bdo id='cE6PZ'><pre id='cE6PZ'><center id='cE6PZ'></center></pre></bdo></b><th id='cE6PZ'></th></span></q></dt></tr></i><div id='cE6PZ'><tfoot id='cE6PZ'></tfoot><dl id='cE6PZ'><fieldset id='cE6PZ'></fieldset></dl></div>

      <small id='cE6PZ'></small><noframes id='cE6PZ'>

    1. <legend id='cE6PZ'><style id='cE6PZ'><dir id='cE6PZ'><q id='cE6PZ'></q></dir></style></legend>
        <bdo id='cE6PZ'></bdo><ul id='cE6PZ'></ul>

        是否可以对在 Python 中返回某些内容的函数进行多

        时间:2023-05-26
          <tbody id='SdA23'></tbody>
      1. <i id='SdA23'><tr id='SdA23'><dt id='SdA23'><q id='SdA23'><span id='SdA23'><b id='SdA23'><form id='SdA23'><ins id='SdA23'></ins><ul id='SdA23'></ul><sub id='SdA23'></sub></form><legend id='SdA23'></legend><bdo id='SdA23'><pre id='SdA23'><center id='SdA23'></center></pre></bdo></b><th id='SdA23'></th></span></q></dt></tr></i><div id='SdA23'><tfoot id='SdA23'></tfoot><dl id='SdA23'><fieldset id='SdA23'></fieldset></dl></div>

            <bdo id='SdA23'></bdo><ul id='SdA23'></ul>
            <tfoot id='SdA23'></tfoot>

            <small id='SdA23'></small><noframes id='SdA23'>

              <legend id='SdA23'><style id='SdA23'><dir id='SdA23'><q id='SdA23'></q></dir></style></legend>

                • 本文介绍了是否可以对在 Python 中返回某些内容的函数进行多处理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  在 Python 中,我看到了许多调用多处理但目标只是打印一些内容的示例.我有一个场景,其中目标返回 2 个变量,我需要稍后使用.例如:

                  In Python I have seen many examples where multiprocessing is called but the target just prints something. I have a scenario where the target returns 2 variables, which I need to use later. For example:

                  def foo(some args):
                     a = someObject
                     b = someObject
                     return a,b
                  
                  p1=multiprocess(target=foo,args(some args))
                  p2=multiprocess(target=foo,args(some args))
                  p3=multiprocess(target=foo,args(some args))
                  

                  现在呢?我可以执行 .start 和 .join,但如何检索单个结果?我需要为我执行的所有作业捕获返回 a,b,然后处理它.

                  Now what? I can do .start and .join, but how do I retrieve the individual results? I need to catch the return a,b for all the jobs I execute and then work on it.

                  推荐答案

                  是的,当然 - 您可以使用多种方法.最简单的方法之一是共享 Queue.在此处查看示例:http://eli.thegreenplace.net/2012/01/16/python-parallelizing-cpu-bound-tasks-with-multiprocessing/

                  Yes, sure - you can use a number of methods. One of the easiest ones is a shared Queue. See an example here: http://eli.thegreenplace.net/2012/01/16/python-parallelizing-cpu-bound-tasks-with-multiprocessing/

                  这篇关于是否可以对在 Python 中返回某些内容的函数进行多处理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何使用python的多处理终止进程 下一篇:Python多处理——跟踪pool.map操作的过程

                  相关文章

                  最新文章

                  <legend id='NxMsm'><style id='NxMsm'><dir id='NxMsm'><q id='NxMsm'></q></dir></style></legend>
                    <tfoot id='NxMsm'></tfoot>

                      <bdo id='NxMsm'></bdo><ul id='NxMsm'></ul>
                    <i id='NxMsm'><tr id='NxMsm'><dt id='NxMsm'><q id='NxMsm'><span id='NxMsm'><b id='NxMsm'><form id='NxMsm'><ins id='NxMsm'></ins><ul id='NxMsm'></ul><sub id='NxMsm'></sub></form><legend id='NxMsm'></legend><bdo id='NxMsm'><pre id='NxMsm'><center id='NxMsm'></center></pre></bdo></b><th id='NxMsm'></th></span></q></dt></tr></i><div id='NxMsm'><tfoot id='NxMsm'></tfoot><dl id='NxMsm'><fieldset id='NxMsm'></fieldset></dl></div>

                  1. <small id='NxMsm'></small><noframes id='NxMsm'>