[Tutor] How to clear the screen
bob gailer
bgailer at gmail.com
Mon Oct 20 14:14:33 CEST 2008
W W wrote:
> On Mon, Oct 20, 2008 at 3:13 AM, Alan Gauld <alan.gauld at btinternet.com
> <mailto:alan.gauld at btinternet.com>> wrote:
>
> "Chris Fuller" <cfuller084 at thinkingplanet.net
> <mailto:cfuller084 at thinkingplanet.net>> wrote
>
>
> want to clear the screen, printing the control sequence ESC[2J
> is all you
> need.
>
> print chr(0x1b) + '[2J'
>
>
> I don't know if this is the most graceful solution... but it seems to
> work:
>
> import os
>
> if os.system('cls') == 0:
> pass
> elif os.system('clear') == 0:
> pass
> else:
> print 'No clear command available'
>
I'd prefer, for compactness and readability:
if not os.system('cls'):
if not os.system('clear'):
print 'No clear command available'
--
Bob Gailer
Chapel Hill NC
919-636-4239
When we take the time to be aware of our feelings and
needs we have more satisfying interatctions with others.
Nonviolent Communication provides tools for this awareness.
As a coach and trainer I can assist you in learning this process.
What is YOUR biggest relationship challenge?
More information about the Tutor
mailing list