如何在Google合作实验室中以编程方式清除Python输出? [英] How to Clear Python Output Programatically in Google Colaboratory?

查看:79
本文介绍了如何在Google合作实验室中以编程方式清除Python输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题是特定于Google Colaboratory的,尽管某些解决方案可能在正常的Python交互器中起作用,但Google Colaboratory似乎不允许我以编程方式清除Python解释器的输出.

This question is specific to Google Colaboratory, while some solutions may work in a normal Python interperter, Google Colaboratory does not seem to allow me to programatically clear the Python interpreter output.

我已经尝试过的解决方案不起作用:

Solutions that I have already tried that do not work:

import os
os.system('cls')
os.system('clear')
!cls
!clear

推荐答案

from IPython.display import clear_output clear_output()

from IPython.display import clear_output clear_output()

这对我很有用.

这篇关于如何在Google合作实验室中以编程方式清除Python输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆