+ 2
How can i clear screen in python ?
8 Respostas
+ 5
This was my question too and @Dimitriy is the only one who answered it correctly. Thank you buddy.
+ 4
if you mean you need to "flush" the console output, you may need to use 'os' module to perform system operations like that.
import os
#then, under Linux, call
os.system('clear')
#under windows call
os.system('cls')
you wrote that you run python under Android, and since Android is Linux-based, 'clear' may work, but it needs to be tested.
+ 1
Yes off course...
Just follow these instructions :-
→From os import system.
→Define a function.
→Make a system call with ‘clear’ in Linux and ‘cls’ in Windows as an argument.
→Store the returned value in an underscore or whatever variable you want (an underscore is used because python shell always stores its last output in an underscore).
→Call the function we defined.
• You can see the implementation also taking one example...
from os import system, name
from time import sleep
def clear():
if name == 'nt':
_ = system('cls')
else:
_ = system('clear')
print('Please upvote my answer if satisfied... \U0001F60A \n\t\t\U0001F60C \n'*25)
sleep(5)
clear()
print("Follow me ...\n \t\t\t https://www.sololearn.com/Profile/18746952/?ref=app")
print("Thanks")
0
Try using ctrl+l on the terminal.
0
but , i using qpython on Android beacouse my computer is broken , sorry i dont good in english beacouse i from Poland.
0
U can use other IDE, like PyCharm or Sublime with syntax highlighting plugin. With ever new run ur program screen will be cleaned. Good luck)
P. S. Try push back button and type new code again.
0
I am using Q Python 3 I wants got the result from searching how to clear screen in python. But now when I am searching I am just getting for Windows and Linux
0
Is there another way avaiable ?
os.system('clear') doesnt work.
Even ctrl+L, clear, cls it also didn't work.