Windows将stdout和stderr重定向到fi

2024-05-08 04:04:43 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图将python脚本的输出重定向到一个文件。我跑过:

C:\>python c:\python_script.py > a.txt 2>&1

找到here,但只有在进程完成或终止后才会写入输出。有没有一种方法可以在将输出写入stdout&stderr时将重定向写入文件?在


Tags: 文件方法pytxt脚本here进程stderr