W W wrote:
On Mon, Oct 20, 2008 at 3:13 AM, Alan Gauld <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    "Chris Fuller" <[EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>> 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?

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to