I am a python beginner, and I am working on an interactive shell/terminal. I want to clear screen interactively with input. Would someone help me please, figure out a cross-platform solution.
Asked
Active
Viewed 356 times
1 Answers
0
Well you can do it with system Lib. If you’re using linux or mac :
system('clear')
Windows :
system('cls')
This a general function :
from os import system, name
def clear():
# for windows
if name == 'nt':
_ = system('cls')
# for mac and linux(here, os.name is 'posix')
else:
_ = system('clear')

Mohamed Zouari
- 395
- 1
- 5
- 14
-
1Thank you so much, It's working – Mohamed Zouari May 08 '20 at 22:05
-
1well you should make a little web search to find how to fix your problems – Mohamed Zouari May 08 '20 at 22:05