473,320 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 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 22220
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: system.out.print("\n\n\n\n\n\n\n\n\n\n\n\n"); then i heard about this method:...
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 clear a portion of my screen. Note: I work in...
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 next printf in standard c? What about ANSI...
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 Kis-Adam <dfighter_AT-NOSPAM_freemail.hu
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 want to clear the screen once an input is entered...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.