This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Jython/Python and the fly likes How to wait for input read a number of seconds Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Languages » Jython/Python
Bookmark "How to wait for input read a number of seconds" Watch "How to wait for input read a number of seconds" New topic
Author

How to wait for input read a number of seconds

Stelian Galmati
Greenhorn

Joined: Aug 12, 2010
Posts: 3
Hi guys,

Does anybody knows how to make a python script wait for input for a number of seconds and if nothing is entered go to next line.

If I use sys.stdin.readline(), I want to wait for input 5 seconds and nothing is entered just skip with a default value.

Thanks
Steve Fahlbusch
Bartender

Joined: Sep 18, 2000
Posts: 557
    
    7

look at the select package.

in specific select.select( )

that is: select.select that should take care of you
Stelian Galmati
Greenhorn

Joined: Aug 12, 2010
Posts: 3
Found it in the meantime. Thanks!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to wait for input read a number of seconds
 
Similar Threads
Wait in Java
Calculation displays scientific format instead of a whole number
How yo use JOptionPane.showInputDialog()
Validation of database path, port number and ip address
Limiting time for user response