How to tell a program to clear the console in python

23 Views Asked by At

Is there a way to automatically clear the console during the execution of a program?

I'm writing a program that requires input from many users, naturally I dont want the next user to see what the previous one put in, so is there a way to automatically trigger clearing the contents of a screen after one user is done inputting their data

I tried looking online but I only got an option to press Ctrl + L, but that's for Linux users, and even that doesn't solve the issue, since the user has to manually clear the screen, I want the program to do it by itself.

I also saw

import os
os.system('cls')

But it doesn't work, I don't know if it has to do with my editor.

There's also the option to just print a new line and multiply it by 100 or something, but that isn't really efficient and someone might just realise that if they scroll up, there's something waiting for them.

I also went through the examples in the "Review questions already on Stack Overflow" and none of them worked, most of them seemed to be a variation of the os.system('cls'), I'm looking for another option

0

There are 0 best solutions below