Ask Your Question
1

How to delete print()

asked 5 years ago

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.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
3

answered 5 years ago

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()
Preview: (hide)
link

Comments

Thank you!

Bryan gravatar imageBryan ( 4 years ago )

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: 5 years ago

Seen: 946 times

Last updated: May 02 '20