[Tutor] Keyboard input

neilconway@home.com neilconway@home.com
Fri, 15 Oct 1999 20:47:36 -0000 (/etc/localtime

Hello all.

2 part question for today:

1) I want to prompt for command-line input, and process that input - similar to
'scanf' in C. 

2) I want to catch keyboard input while my program is running. How would I go
about doing this? Do I have to wrap everything in a large try/except statement?
That seems clumsy to me.

I'll illaborate on #2. Lets say my program is running. For the sake of argumet,
lets say it is counting up to 100000, printing every 100th number:
count = 0
while count < 100000:
      if count % 100 == 0:
             print count
      count = count + 1

While this program is running, if the user presses ^Z, then it, say,
prints "Hello". How would I go about coding this?

The example doesn't matter, I am just trying to explain what I would like
to be able to do.

Thanks a lot in advance,

Neil Conway