472,353 Members | 2,094 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

screen clear question

Is there a command in Python to clear the screen? That is without writing
multiple blank lines.

Thanks.

Jim C
Jul 18 '05 #1
6 22097
On Sun, 2005-01-02 at 11:31, jcollins wrote:
Is there a command in Python to clear the screen? That is without writing
multiple blank lines.


Without knowing what 'screen' you're talking about, it's hard to say. If
you mean clearing a terminal, you can call 'tput clear' or
'/usr/bin/clear' on many UNIX systems; no idea about Windows.

--
Craig Ringer

Jul 18 '05 #2
import os

# windows
os.system("cls")

# bash ( mac, linux )
os.system("clear")

That's all I can account for.

Daniel Bickett
Jul 18 '05 #3
On Sun, 02 Jan 2005 14:23:07 +0800, Craig Ringer
<cr***@postnewspapers.com.au> wrote:
On Sun, 2005-01-02 at 11:31, jcollins wrote:
Is there a command in Python to clear the screen? That is without writing
multiple blank lines.


Without knowing what 'screen' you're talking about, it's hard to say. If
you mean clearing a terminal, you can call 'tput clear' or
'/usr/bin/clear' on many UNIX systems; no idea about Windows.


On Windows the DOS CLS command will clear a command prompt, it
also works for CP/M and VAX terminals too. Finally I think the
curses module allows you to clear a window, including the main
window - ie the terminal screen.

In each case run CLS (or clear) via os.system()

But the bottom line is that there is no builtin command
because the mechanism is different on each platform.

Alan G.
Author of the Learn to Program website
http://www.freenetpages.co.uk/hp/alan.gauld
Jul 18 '05 #4
Alan Gauld wrote:
But the bottom line is that there is no builtin command
because the mechanism is different on each platform.


I'd have said it was because the inpreter is line-oriented rather than
screen-oriented, but YMMV.

Cheers,
Nick.

--
Nick Coghlan | nc******@email.com | Brisbane, Australia
---------------------------------------------------------------
http://boredomandlaziness.skystorm.net
Jul 18 '05 #5
On Mon, 03 Jan 2005 02:15:23 +1000, Nick Coghlan
Alan Gauld wrote:
But the bottom line is that there is no builtin command
because the mechanism is different on each platform.


I'd have said it was because the inpreter is line-oriented rather than
screen-oriented, but YMMV.


Yeah, that might be a reason as well :-)

But then the early PC GW-Basic or BASICA interpreters were line
based too but both provided a CLS command because the *programs*
that were written were usually screen based... But they ran on a
single OS so a CLS was easily possible.

Alan G.
Author of the Learn to Program website
http://www.freenetpages.co.uk/hp/alan.gauld
Jul 18 '05 #6
Nick Coghlan wrote:
Alan Gauld wrote:
But the bottom line is that there is no builtin command because the
mechanism is different on each platform.

I'd have said it was because the inpreter is line-oriented rather than
screen-oriented, but YMMV.

Cheers,
Nick.

I would try doing a test against the resident OS the program is running
against and set the clear command based on that.
--
Thank you,
Andrew Robert

E-mail: ar*****@townisp.com
Ur: http://shardservant.no-ip.info
Jul 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Dave | last post by:
Hi, I have done some research, trying to Clear The Screen in java code. The first option was the obv:...
3
by: Miki Tebeka | last post by:
Hello All, I'd like to bind <CTRL+L> so that it will clear IDLE's screen (in the interactive prompt). Any pointers/suggetions? Thanks. Miki
18
by: Tim Mierzejewski | last post by:
How do I clear the text from my screen, other than a bunch of \n's or endl's? Tim M.
51
by: someone | last post by:
I was just wondering if there is any way of editing anything already printed on the screen with out using the system("cls") command.
11
by: Rajendran | last post by:
I just want to clear the above three lines from the current position, so that I can start printing my results from that point. In short I want to...
10
by: Kenneth Lantrip | last post by:
My question is: Is there a generally accepted way to clear the screen and perhaps move the cursor to a new location (other than newline) for the...
65
by: Leslie Kis-Adam | last post by:
Hi everyone! Does anyone know, if it is possible to clear the screen in ANSI C? If it is,then how? Any help would be appreciated. Laszlo...
6
by: andrewanderson | last post by:
hi i would like to know what are the method to clear the comand window screen using visual c++ what are the codes to use? can anyone help me? i...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.