python - 创建一个新的终端/shell 窗口以简单地显示文本

标签 python shell

我想通过管道[编辑:实时文本]将多个子进程(有时是链接的,有时是并行的)的输出传输到不是事件的 python shell 的单个终端/tty 窗口(无论是 IDE、命令行还是,或使用 tkinter 的运行脚本)。 IPython 不是一个选择。我需要标准安装附带的东西。更喜欢与操作系统无关的解决方案,但需要在 XP/Vista 上工作。

如果你想要的话,我会发布我已经尝试过的内容,但这很尴尬。

最佳答案

Unix 中一个好的解决方案是命名管道。我知道您询问了有关 Windows 的问题,但 Windows 中可能有类似的方法,或者这可能对其他人有帮助。

在航站楼 1 上:

mkfifo /tmp/display_data
myapp >> /tmp/display_data

在终端 2 (bash) 上:

tail -f /tmp/display_data

编辑:将终端 2 命令更改为使用“tail -f”而不是无限循环。

关于python - 创建一个新的终端/shell 窗口以简单地显示文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/866737/

相关文章:

python - 希望加快循环,包括 Pandas 操作

python - 使用虚拟环境时安装python模块

python - 将图像从目录 (Python) 导入列表或字典

python - 重新加载当前运行的 python 脚本

java - 如何在 Java 中保存 shell 脚本的 echo 输出

linux - shell脚本(AIX) : finding a string after the matched pattern line by line in a file

shell - 在shell脚本中使用curl

python - 向 Django 模型添加动态字段

Linux Shell 脚本 : if/else works on bash but not zsh or sh

linux - 给定行范围时如何使用 sed 命令从文本文件中提取内容?