Reading standard input

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • MindClass

    #1

    Reading standard input

    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 KeyboardInterru pt for that doesn't show that
    message. How would it be possible?

  • Fredrik Lundh

    #2
    Re: Reading standard input

    MindClass wrote:
    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)

    I also would to trap the KeyboardInterru pt for that doesn't show that
    message. How would it be possible?
    any reason you cannot use an ordinary try-except for that?

    </F>


    Comment

    Working...