简体   繁体   English

如何抑制python输出到屏幕?

[英]How to suppress python output to screen?

I am using python.我正在使用python。

The following line of code prints some information to the screen:以下代码行将一些信息打印到屏幕上:

p = open3d.read_point_cloud("data.ply") , p = open3d.read_point_cloud("data.ply") ,

which prints Reading PLY: [========================================] 100%打印Reading PLY: [========================================] 100%

I want to suppress the printed information.我想抑制打印的信息。

I tried this:我试过这个:

text_trap = io.StringIO()
sys.stdout = text_trap

p = open3d.read_point_cloud("data.ply")

sys.stdout = sys.__stdout__

However it does not work.但是它不起作用。 I found the implementation of this function to be inside a .so file.我发现这个函数的实现在一个.so文件中。

Can anyone provide help?任何人都可以提供帮助吗? Appreciate it!欣赏它!

I wanted to add this as a comment but, I don't have enough rep to add comments, so Typing it as a answer.我想将此添加为评论,但是我没有足够的代表来添加评论,因此将其作为答案输入。

Have you tried to use the print_progress parameter, this might solve your problem您是否尝试过使用 print_progress 参数,这可能会解决您的问题

p = open3d.read_point_cloud("data.ply",print_progress=False)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM