-2

How do i make python hide text that was printed earlier in the project? (I'm using repl if that changes anything.) Like imagine my code was. print('Loading') Name = input('Enter Username') how would I make the word "Loading" Hide 10 seconds later?

  • ```print()``` command is for output and it can't be undone so basically you can't hide with print . I would show you how to do it with sleep if you wait a few minutes – Ata Reenes Jan 13 '21 at 14:24
  • All I can think of is printing out a whole load of new lines 10 seconds after doing `print('Loading')` – BlueStaggo Jan 13 '21 at 14:25
  • Does this answer your question? [Python hide already printed text](https://stackoverflow.com/questions/35813667/python-hide-already-printed-text) – kishore Rajendran Jan 13 '21 at 14:25
  • 1
    Does this answer your question? [How to clear the interpreter console?](https://stackoverflow.com/questions/517970/how-to-clear-the-interpreter-console) – Chris Jan 13 '21 at 14:26

2 Answers2

1

Perhaps the OS module might work. You could use `os.system("cls") to clear EVERYTHING in the terminal. This might not work on repl though.

Try this:

import os
from time import sleep

print("Hello world!")
sleep(1)
os.system("cls") #"clear" For Linux
print("This came AFTER hello world line")
sleep(1)
The Pilot Dude
  • 2,091
  • 2
  • 6
  • 24
0

so I couldn't write in little time due to something :

import time
import curses

stdscr = curses.initscr()

stdscr.addstr(0, 0, "Hello")
stdscr.refresh()

time.sleep(1)

stdscr.addstr(0, 0, "World! (with curses)")
stdscr.refresh()

I think it can answer your question.

Ata Reenes
  • 188
  • 1
  • 10
  • amazing! it basically switches out the new text with the old! Thank you i really appreciate it. :) –  Jan 13 '21 at 15:19