+ 2

How to clear the screen in python

23rd Jul 2018, 4:44 AM
Naveen
Naveen - avatar
3 odpowiedzi
+ 5
import subprocess, os def cls(): _ = subprocess.call('clear' if os.name == 'posix' else 'cls')
23rd Jul 2018, 11:07 AM
Mert Yazıcı
Mert Yazıcı - avatar
+ 2
An interesting question with no easy answer it seems - see https://stackoverflow.com/q/1432480 print("\n" * 100) sort of works Perhaps the real Pythonistas around here have some ideas...
23rd Jul 2018, 5:41 AM
David Ashton
David Ashton - avatar
+ 1
import os os.system("cls") or os.system("clear") depending on OS. or print("\n" * 100) those are a few possibilities
23rd Jul 2018, 7:32 AM
Markus Kaleton
Markus Kaleton - avatar