how to clear last line of screen in python command code example Example: how to clear console python import os os.system('cls' if os.name == 'nt' else 'clear')