It's not uncommon for C++ tutorials etc, to refer to using:
system("cls");
to clear the screen (in windows console environments only). I assume this
is what ankith was talking about.
The python equivalent would be:
import os
os.system('cls')
or in the repl:
_ = os.system('cls').
Note, ipython (on linux only, it seems) adds a built-in alias called
`clear` which does the same thing.
Unfortunately, implementing this behaviour in a reliable, cross-platform
way is reasonably hard. Python has the standard library module: curses,
which can be made to provide similar behaviour (with some side-effects) but
this doesn't work in the traditional windows console. There may be some
other functionality buried somewhere in the stdlib that does this?
Some third party libraries do a reasonable job at providing this feature,
and it feels like 3rd party libraries are the correct place for this
For example, the pypi `console` library provides a method:
`console.sc.reset()` that behaves similarly to `CLS` on windows and also
appears to be fairly reliable cross-platform.
Steve
On Tue, Oct 13, 2020 at 1:41 PM Serhiy Storchaka
13.10.20 09:07, ankith abhayan пише:
I would like to request a new feature that allows you to clear the console screen. Like in c++, the CLS function
There is no the CLS function in C++. _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/L3FA6U... Code of Conduct: http://python.org/psf/codeofconduct/