def yes_no_input(msg):
if hasattr(__builtin__, 'raw_input'):
input = __builtin__.raw_input
else:
input = builtins.input
try:
choice = input("{} [y/N]: ".format(msg)).lower()
while True:
if choice in ['y', 'ye', 'yes']:
return True
elif choice in ['n', 'no']:
return False
else:
choice = input(
"Please respond with 'yes' or 'no' [y/N]: ").lower()
except (EOFError, KeyboardInterrupt):
return False
评论列表
文章目录