Reading standard input

MindClass jonas.esp at googlemail.com
Sat Oct 28 09:17:22 EDT 2006


The program shows a license text, then the user has to accept the
license (or not).
Is there another way to get text from console? (that using
sys.stdin.read)

foo = sys.stdin.read(3)
if foo != 'yes'
    sys.exit(0)

I also would to trap the KeyboardInterrupt for that doesn't show that
message. How would it be possible?




More information about the Python-list mailing list