开发者

How to close stdout/stderr window in python?

开发者 https://www.devze.com 2023-01-11 06:26 出处:网络
In my python app, I print some stuff during a cycle. After the cycle, I want to close the stdout/stderr wind开发者_开发问答ow that the prints produced using python code.import sys

In my python app, I print some stuff during a cycle.

After the cycle, I want to close the stdout/stderr wind开发者_开发问答ow that the prints produced using python code.


import sys

sys.stdout.close()
sys.stderr.close()

Might be what you want. This will certainly close stdout/stderr at any rate.


If you mean the prompt window that opens when you run a Python script on MS Windows, try specifying the executable pythonw instead of python, on the first line of your script.

0

精彩评论

暂无评论...
验证码 换一张
取 消