clear screen returning 256 in python
Question:
I am using mac. I wrote the below code to clear the screen
>>> import os
>>> os.system('clear')
it should clear the screen but its returning 256
its returning 1 for
import subprocess
>>> subprocess.call("clear")
Answers:
I run os.system('clear')
on Ubuntu 11.04 alternate : it cleared the screen.
The return value you get depends on the operating system as Python documentation states:
Note that POSIX does not specify the meaning of the return value of
the C system() function, so the return value of the Python function is
system-dependent.
I was having the same issue here. (and yes guys, ‘clear’ command on OSX terminal is like "cls" on windows.)
This solved my problem: use the terminal, not the Visual Studio Code Terminal, os IDLE (Python) Terminal. But the original Mac OSX terminal.
I am using mac. I wrote the below code to clear the screen
>>> import os
>>> os.system('clear')
it should clear the screen but its returning 256
its returning 1 for
import subprocess
>>> subprocess.call("clear")
I run os.system('clear')
on Ubuntu 11.04 alternate : it cleared the screen.
The return value you get depends on the operating system as Python documentation states:
Note that POSIX does not specify the meaning of the return value of
the C system() function, so the return value of the Python function is
system-dependent.
I was having the same issue here. (and yes guys, ‘clear’ command on OSX terminal is like "cls" on windows.)
This solved my problem: use the terminal, not the Visual Studio Code Terminal, os IDLE (Python) Terminal. But the original Mac OSX terminal.