spacepy.toolbox.query_yes_no¶
- spacepy.toolbox.query_yes_no(question, default='yes')[source]¶
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”.
- Parameters
- questionstring
the question to ask
- defaultstring (optional)
- Returns
- outstring
answer (‘yes’ or ‘no’)
Examples
>>> import spacepy.toolbox as tb >>> tb.query_yes_no('Ready to go?') Ready to go? [Y/n] y 'yes'