This is a development version (latest) and may be unstable. Go to latest (9.13.0)
{ } Raw JSON

bundles / IPython latest / IPython / utils / io / ask_yes_no

function

IPython.utils.io:ask_yes_no

source: /IPython/utils/io.py :84

Signature

def   ask_yes_no ( prompt default = None interrupt = None )

Summary

Asks a question and returns a boolean (y/n) answer.

Extended Summary

If default is given (one of 'y','n'), it is used if the user input is empty. If interrupt is given (one of 'y','n'), it is used if the user presses Ctrl-C. Otherwise the question is repeated until an answer is given.

An EOF is treated as the default answer. If there is no default, an exception is raised to prevent infinite loops.

Valid answers are: y/yes/n/no (match is not case sensitive).

Aliases

  • IPython.core.interactiveshell.ask_yes_no