Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(2)  |  Call(1)  |  Derive(0)  |  Import(1)
Display confirm prompt on command line

msg:
    The message to display to the user
default:
    Default True/False (yes/no) at the prompt

        def confirm(msg, default=True):
    """
    Display confirm prompt on command line

    msg:
        The message to display to the user
    default:
        Default True/False (yes/no) at the prompt
    """
    if default is True:
        display = '{0} [Y/n] '.format(msg)
    else:
        display = '{0} [y/N] '.format(msg)

    res = raw_input(display)
    if default is True:
        return True if len(res) == 0 or res.lower().startswith('y') else False
    else:
        return True if len(res) > 0 and res.lower().startswith('y') else False
        


src/s/e/sesame-0.3.2/sesame/cli.py   sesame(Download)
from sesame.utils import ask_create_key
from sesame.utils import ask_overwrite
from sesame.utils import confirm
from sesame.utils import find_sesame_keys
from sesame.utils import read_key
            if args.mode == MODE_ENCRYPT or (args.mode == MODE_DECRYPT and args.try_all is False):
                # ask the user if they want to use the first key found
                if confirm("No key supplied and {0} found. Use '{1}'?".format(
                    len(keys), keys.keys()[0]
                ), default=True):