On Wed, 14 Jan 2009 09:45:58 -0800, Dennis Lee Bieber wrote:

> Personally -- I'd accept anything that started with the character:
> 
>       while True:
>               password = input(prompt).lower()
>               if password.startswith("y"):
>                       return True
>               elif password.startswith("n"):
>                       return False
[...]


>>> response = input("Shall I delete all your files? ").lower()
Shall I delete all your files? Ye gods, NOOO!!!!!
>>> if response.startswith('y'): print "Deleting files now"
...
Deleting files now


There are times where being flexible in what you accept is *not* a virtue.


-- 
Steven

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to