yash bhangare
yash bhangare

Reputation: 319

How can we reset the content of console using python?

import threading
import time
import os

def clearAfter15():
    clear = lambda: os.system('clear/cls')
    clear()

string_variable="This message will be disappear after 1 minutte"
t = threading.Timer(1*60, clearAfter15)
t.start()
print(string_variable)

Expected : After 1 minute the output will get disappeared from the console

Upvotes: 0

Views: 70

Answers (1)

user12991524
user12991524

Reputation:

Try this:

def clearAfter15():
    clear = lambda: os.system('cls' if os.name == 'nt' else 'clear')
    clear()

Upvotes: 1

Related Questions