Dick Moores wrote: > OK, here's a short script, which runs fine on Windows. What do I add > to have it run on unix as well? > > #!/usr/bin/env python > #coding=utf-8 > > try: > # windows or dos > import msvcrt > while True: > if msvcrt.kbhit(): > key = msvcrt.getch() > if key == "h": > print "Hello, World!" > break > print "Bye, World!" > > except ImportError: > # assume unix > import tty, termios
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/134892 Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor