簡體   English   中英

盡管在后台運行,Python仍會打印到終端

[英]Python prints to the terminal despite being run in the background

在后台運行時,如何避免將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
打印到終端,直接進入我的命令提示符。

python testing.py > /dev/null &

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM