How to clear console in Python

1 Answer

0 votes
import os

def clearConsole():
    command = 'clear'
    if os.name in ('nt', 'dos'):  # for windows
        command = 'cls'
    os.system(command)

clearConsole()




     
'''
run:
     

     
'''

 



answered May 1, 2021 by avibootz

Related questions

1 answer 198 views
198 views asked Jun 1, 2023 by avibootz
1 answer 162 views
162 views asked Jun 11, 2015 by avibootz
1 answer 131 views
4 answers 239 views
239 views asked Apr 17, 2021 by avibootz
1 answer 172 views
1 answer 175 views
...