After entering data and displayed something, I want to get clear the console. eg:-
num1=int(input('Number 1: '))
print(num1)
Then in the next code line, I want to clear the console to next process, without cleaning the num1
variable value.
This is the java method that can solve my problem. I want the python code as this.
public final static void clearConsole() {
try {
final String os = System.getProperty("os.name");
if (os.contains("Windows")) {
new ProcessBuilder("cmd", "/c", "cls").inheritIO().start().waitFor();
} else {
System.out.print("\033[H\033[2J");
System.out.flush();
}
} catch (final Exception e) {
e.printStackTrace();
// Handle any exceptions.
}
}