Skip to content

Instantly share code, notes, and snippets.

@MedeirosJoel
Last active September 10, 2022 13:36
Show Gist options
  • Save MedeirosJoel/2f108f1d24e7f917c140f53d995ad1c3 to your computer and use it in GitHub Desktop.
Save MedeirosJoel/2f108f1d24e7f917c140f53d995ad1c3 to your computer and use it in GitHub Desktop.
Uma função python que limpa o terminal
from os import system, name
from time import sleep
def cls(tEspera=0.0):
"""
Esta é uma função que limpa o terminal do python/OS
Utilizando a função OS do sistema ela recebe a interface de acesso ao terminal \n
Podeaguardar antes de limpar a tela para exibição de um resultado temporario em segundos
exemplos de uso: cls(5), cls(0.4), cls()
"""
sleep(tEspera)
if name == 'posix': system('clear')
elif name == 'nt': system('cls')
else: print("\n"*160)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment