Is there a simple way to exit a while loop on keystroke?

2007-08-31 Thread gsxg
I am new to python, and have written a simple program to read a port via telnet. I would like it to run until any key is pressed. Of course I wouldn't mind requiring a specific keystroke in the future, but I would think this is simpler for now. I have used kbhit() and getch() many times in C, bu

Re: Is there a simple way to exit a while loop on keystroke?

2007-08-31 Thread gsxg
Thanks, The curses library doesn't look to helpful to me. However using CTRL- C is fine and is working nicely. BTW, it should be "time.sleep(1)" in the example above, instead of just "sleep(1)" (Just in case any other newbies like me read this) Thanks again -- http://mail.python.org/mailman/l