How can i overwrite the previous "print" value in python?
print "hello"
print "dude"
print "bye"
It will output:
hello
dude
bye
But i want to overwrite the value.
In this case the output will be:
bye
How can i overwrite the previous "print" value in python?
print "hello"
print "dude"
print "bye"
It will output:
hello
dude
bye
But i want to overwrite the value.
In this case the output will be:
bye
Check this curses library, The curses library supplies a terminal-independent screen-painting and keyboard-handling facility for text-based terminals. An example:
x.py:
from curses import wrapper
def main(stdscr):stdscr.addstr(1, 0, 'Program is running..') # Clear screenstdscr.clear() # clear above line. stdscr.addstr(1, 0, 'hello')stdscr.addstr(2, 0, 'dude')stdscr.addstr(3, 0, 'Press Key to exit: ')stdscr.refresh()stdscr.getkey()wrapper(main)
print('bye')
run it python x.py