Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=3841475
By: ming_wen
for example:
def ask_ok(prompt, retries=4, complaint='Yes or no, please!'):
while 1:
ok = raw_input(prompt)
if ok in ('y', 'yes'):
return True
if ok in ('n', 'no'):
return False
retries = retries - 1
if retries < 0:
raise IOError, 'refusenik user'
print complaint
while 1:
flag = ask_ok('are you really want to quit?')
if flag == True:
break
print 'out'
In Eclipse 3.2/Python 2.4,the output always is"Yes or no, please! "
however,if you add a '\r' after the word which compare with 'ok',e.g.'y'->'y\r'.
Then the result will be right.
So,I guess Pydev don't have a good deal with the 'enter'.It should only be the
end of input,not in the input.
______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=293649
|