Skip to content

Instantly share code, notes, and snippets.

View carlos-wong's full-sized avatar

carlos carlos-wong

  • Lejurobot.com
  • china, shenzhen
View GitHub Profile
@carlos-wong
carlos-wong / python: query yes or not
Created April 17, 2013 05:42
python: yes or not
def query_yes_no(question, default="yes"):
"""Ask a yes/no question via raw_input() and return their answer.
"question" is a string that is presented to the user.
"default" is the presumed answer if the user just hits <Enter>.
It must be "yes" (the default), "no" or None (meaning
an answer is required of the user).
The "answer" return value is one of "yes" or "no".
"""