Ask Your Question
1

How to delete print()

asked 2020-05-02 14:07:55 +0200

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 14:59:19 +0200

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 15:44:12 +0200 )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 14:07:55 +0200

Seen: 87 times

Last updated: May 02 '20