Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Reading standard input

Reply
Thread Tools

Reading standard input

 
 
MindClass
Guest
Posts: n/a
 
      10-28-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?

 
Reply With Quote
 
 
 
 
Fredrik Lundh
Guest
Posts: n/a
 
      10-28-2006
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)


http://effbot.org/pyref/raw_input.htm

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


any reason you cannot use an ordinary try-except for that?

</F>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading Java byte[] data stream over standard input sapsi Python 6 05-19-2008 01:21 PM
Reading from standard input Harpreet Perl Misc 5 09-29-2006 07:13 AM
add pexpect to the standard library, standard "install" mechanism. funkyj Python 5 01-20-2006 08:35 PM
How standard is the standard library? steve.leach Python 1 04-18-2005 04:07 PM
Reading from piped standard input on w2k Yuri Shtil Perl Misc 1 06-30-2003 10:17 PM



Advertisments