clear screen in python | Sololearn: Learn to code for FREE!

0

clear screen in python

How to clear console screen in python?

2/3/2018 1:01:18 PM

Haider Ali

10 Answers

New Answer

+7

Exactly, because it's OS-dependent. It executes the in-built operating system command, which is available only in DOS/Windows. That's why it's better to use the multiple newlines thing.

+6

print('\n'*25) ;) Seriously, you can use os.system('cls') for windows or os.system('clear') fo Linux, but printing newlines is always guaranteed to work without importing any modules.

+1

os.system('cls') doesn't work for me :(

+1

remember to import os ^^

0

@Markus i did import os. it doesn't either way

0

if u open cmd and type cls in it, does it clear?

0

@Markus it does

0

weird... it does absolutely nothin? errors?

0

@Markus cls clears in cmd while in python program, it doesn't work at all. it is bizzare

0

hmm really weird