'Clearing Console in Python

I've been having trouble clearing the console on python. I've tried to do Console.Clear() and clear() but for some reason they haven't been working.



Solution 1:[1]

Are you using windows? Perhaps try:

import os
os.system(‘cls’)

to clear the console instead.

Solution 2:[2]

I think this will help you: Click here

There are multiple ways depends on your operating system

The fastest option would be:

print("\033c", end='')

Good luck :)

Solution 3:[3]

For MacOS and Linux:

import os
os.system("clear")

for Windows:

import os
os.system("cls")

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 aquaplane
Solution 2
Solution 3 jirassimok