How To Clear Screen In Python 3.9.7?

In python 3.9.7, is there any way to clear the output terminal by defining functions or use pre-defined? I tried another solution on this site which said to use _clear, but it did not work.

>Solution :

Try this:

import os
os.system('cls' if os.name == 'nt' else 'clear')

This will help you clear the screen

Leave a Reply