“Przezroczysta konsola Python Python” Kod odpowiedzi

Jak wyczyścić Python konsoli

def clear(): 
  
    # for windows 
    if name == 'nt': 
        _ = system('cls') 
  
    # for mac and linux(here, os.name is 'posix') 
    else: 
        _ = system('clear') 
Expensive Eagle

Clear Console w Python

As you mentioned, you can do a system call:

For Windows
>>> import os
>>> clear = lambda: os.system('cls')
>>> clear()

For Linux the lambda becomes
>>> clear = lambda: os.system('clear')
Ankur

Przezroczysta konsola Python Python

import os
clear = lambda: os.system('cls')
# Then use clear(), to clear terminal
Temerold

Odpowiedzi podobne do “Przezroczysta konsola Python Python”

Pytania podobne do “Przezroczysta konsola Python Python”

Więcej pokrewnych odpowiedzi na “Przezroczysta konsola Python Python” w Python

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu