Re: Clearing a DOS terminal in a script
- From: John Machin <sjmachin@xxxxxxxxxxx>
- Date: Thu, 13 Dec 2007 10:56:56 -0800 (PST)
On Dec 14, 3:48 am, Stephen_B <step...@xxxxxxxxxxxxxx> wrote:
This doesn't seem to work in a dos terminal at the start of a script:
from os import popen
print popen('clear').read()
Any idea why not? Thanks.
Maybe you are using a different "dos terminal". What is "clear"?
C:\junk>clear
'clear' is not recognized as an internal or external command,
operable program or batch file.
C:\junk>ver
Microsoft Windows XP [Version 5.1.2600]
C:\junk>help cls
Clears the screen.
CLS
C:\junk>
The following works for me:
<code>
import os
os.system('cls')
print 'Howzat?'
</code>
To use ANSI escape sequences with the "real" MS-DOS, one needed a
console device driver (ANSI.SYS was supplied) and had to invoke it in
the CONFIG.SYS file; presumably you can find out how to set this up in
a Windows Command Prompt window, but it doesn't seem to be worth the
bother if all you want to do is clear the window.
HTH,
John
.
- References:
- Clearing a DOS terminal in a script
- From: Stephen_B
- Clearing a DOS terminal in a script
- Prev by Date: Re: python vs perl performance test
- Next by Date: Re: Dynamic or not?
- Previous by thread: Re: Clearing a DOS terminal in a script
- Next by thread: Re: Clearing a DOS terminal in a script
- Index(es):
Relevant Pages
|