Ask Your Question
1

How to delete print()

asked 2020-05-02 07:07:55 -0500

Bryan gravatar image

I want to do print a loading String, while a heavy function is loading and to delete it afterwards:

print("Loading...")
callFunction() 
delete print

I've already tried with python syntax, and nothing works apparently. Does anyone of you know a solution? Thank you in advance.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
3

answered 2020-05-02 07:59:19 -0500

Juanjo gravatar image

I assume that you are working in a Jupyter notebook. The following code may suit your needs:

from IPython.display import clear_output
print("Loading...")
sleep(5) # This emulates the function loading
print("Done")
sleep(2)
clear_output()
edit flag offensive delete link more

Comments

Thank you!

Bryan gravatar imageBryan ( 2020-05-31 08:44:12 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2020-05-02 07:07:55 -0500

Seen: 58 times

Last updated: May 02