I would like to know if it is possible to limit the amount of time a print statement appears in the user console. I have a project that is a Contact Manager and it used a CSV file to store the contact data. The program is designed to create a new CSV file in the even that one is not available in the directory. If I run the program without the CSV file in the directory I have the console display a message to the user letting them know that a new file was created. I would like to have this message only display for maybe 10 seconds or so then disappear from the console. Is this possible? If so I would appreciate some suggestions. Below is the portion of the code that checks for the CSV file then creates a new one and notifies the user if a new one has been created.
def read_contacts():
try:
contacts = []
with open(FILENAME, newline="") as file:
reader = csv.reader(file)
for row in reader:
contacts.append(row)
return contacts
except FileNotFoundError:
print("Could not find " + FILENAME + " file!\n + "Starting new contacts file...\n")
At this point the code continues to create a new CSV file. What I would like to do is have the previous print statement disappear after 10 seconds so that it doesn't display in the console the entire time the program is running.