Skip to content

Instantly share code, notes, and snippets.

@Visgean
Last active February 18, 2016 16:14
Show Gist options
  • Save Visgean/14b5e3c01b32a008831d to your computer and use it in GitHub Desktop.
Save Visgean/14b5e3c01b32a008831d to your computer and use it in GitHub Desktop.
def yesno(prompt, answers=None):
if answers is None:
answers = {
'yes': True,
'no': False
}
prompt = prompt.encode('ascii', 'ignore')
while True:
answer = raw_input(u'{0} [{1}]: '.format(
prompt,
u'/'.join(answers.keys())
))
if answer in answers:
return answers[answer]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment