goto, cls, wait commands

Harlin harlinseritt at yahoo.com
Thu Feb 10 17:41:17 EST 2005


No goto needed. If this makes no sense (which it may not if all you've
been exposed to is BASIC) it wouldn't be a bad idea to Google why you
should never use a goto statement.

To do a clear screen you'll need to use the method that your command
shell uses. The shortcut to this is for Windows, 'cls' and Linux (and
other Unix derivatives) is 'clear'. To put this into your programs
you'll need to import the OS module. Then use the method, system() to
run the command:

import os
os.system('cls')

or

os.system('clear')

To do a 'wait' you can use the Time module.

import time

seconds = 10      #This is an integer value
time.sleep(seconds)

Only on Unix systems can you use the system command 'sleep'. However,
in the name of portability it's better to use the Python modules
whenever possible (they'll work on any system that supports Python).

Hope it helps.

Harlin




More information about the Python-list mailing list