• <small id='hugGm'></small><noframes id='hugGm'>

        <bdo id='hugGm'></bdo><ul id='hugGm'></ul>
      <legend id='hugGm'><style id='hugGm'><dir id='hugGm'><q id='hugGm'></q></dir></style></legend>

      1. <tfoot id='hugGm'></tfoot>

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

        Python3子进程通信示例

        Python3 subprocess communicate example(Python3子进程通信示例)

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

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

            • <tfoot id='JTQRg'></tfoot>
            • <legend id='JTQRg'><style id='JTQRg'><dir id='JTQRg'><q id='JTQRg'></q></dir></style></legend>
                <bdo id='JTQRg'></bdo><ul id='JTQRg'></ul>

                1. 本文介绍了Python3子进程通信示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我是子处理的新手.

                  我只需要一个在 parent.pychild.py 之间进行通信的非常简单的 win32 示例.从 parent.py 发送到 child.py 的字符串,由 child.py 更改并从 parent.py 发送回 parent.py 以进行 print().

                  我发布这个是因为我发现的示例最终不是 win32 或者没有使用让我感到困惑的孩子.

                  I just need a really simple win32 example of communicate() between a parent.py and child.py. A string sent from parent.py to child.py, altered by child.py and sent back to parent.py for print() from parent.py.

                  I'm posting this because examples I have found end up either not being win32 or not using a child which just confuses me.

                  感谢您的帮助.

                  推荐答案

                  这里是根据您的要求的一个简单示例.此示例是 Python 3.x(2.x 需要稍作修改).

                  Here is a simple example as per your requirements. This example is Python 3.x (slight modifications are required for 2.x).

                  import subprocess
                  import sys
                  
                  s = "test"
                  p = subprocess.Popen([sys.executable, "child.py"],
                                       stdin=subprocess.PIPE,
                                       stdout=subprocess.PIPE)
                  out, _ = p.communicate(s.encode())
                  print(out.decode())
                  

                  child.py

                  s = input()
                  s = s.upper()
                  print(s)
                  

                  我在 Mac OS X 上编写并测试了它.这里没有特定于平台的代码,所以没有理由它也不能在 Win32 上运行.

                  I wrote and tested this on Mac OS X. There is no platform-specific code here, so there is no reason why it won't work on Win32 also.

                  这篇关于Python3子进程通信示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Pythonic and efficient way of finding adjacent cells in grid(在网格中查找相邻单元格的 Pythonic 和有效方法)
                  map a hexagonal grid in matplotlib(在 matplotlib 中映射六边形网格)
                  Execute arbitrary python code remotely - can it be done?(远程执行任意 python 代码 - 可以吗?)
                  Python - Plotting colored grid based on values(Python - 根据值绘制彩色网格)
                  Is there a GUI design app for the Tkinter / grid geometry?(是否有 Tkinter/网格几何图形的 GUI 设计应用程序?)
                  tkinter Canvas Scrollbar with Grid?(带有网格的 tkinter 画布滚动条?)
                2. <legend id='Wp83Z'><style id='Wp83Z'><dir id='Wp83Z'><q id='Wp83Z'></q></dir></style></legend>
                3. <i id='Wp83Z'><tr id='Wp83Z'><dt id='Wp83Z'><q id='Wp83Z'><span id='Wp83Z'><b id='Wp83Z'><form id='Wp83Z'><ins id='Wp83Z'></ins><ul id='Wp83Z'></ul><sub id='Wp83Z'></sub></form><legend id='Wp83Z'></legend><bdo id='Wp83Z'><pre id='Wp83Z'><center id='Wp83Z'></center></pre></bdo></b><th id='Wp83Z'></th></span></q></dt></tr></i><div id='Wp83Z'><tfoot id='Wp83Z'></tfoot><dl id='Wp83Z'><fieldset id='Wp83Z'></fieldset></dl></div>

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

                      • <tfoot id='Wp83Z'></tfoot>
                          <tbody id='Wp83Z'></tbody>

                            <bdo id='Wp83Z'></bdo><ul id='Wp83Z'></ul>