尽管在后台运行,Python仍会打印到终端

0 python terminal

在后台运行时如何避免python打印到终端?我希望它在前台运行时打印或通过管道传输到另一个文件,它成功完成,但在后台运行时不打印.

例如,我有一个文件testing.py.有一行:
print("This is just a test")
如果我在终端中运行
>python testing.py
它给了我:
This is just a test
但是,如果我在后台运行脚本,
python testing.py &
我仍然会
This is just a test
打印到终端,直接进入我的命令提示符.

Arn*_*son 5

python testing.py > /dev/null &
Run Code Online (Sandbox Code Playgroud)