__init__.py 文件源码

python
阅读 50 收藏 0 点赞 0 评论 0

项目:mpienv 作者: keisukefukuda 项目源码 文件源码
def yes_no_input(msg):
    if hasattr(__builtin__, 'raw_input'):
        input = __builtin__.raw_input
    else:
        input = builtins.input

    try:
        choice = input("{} [y/N]: ".format(msg)).lower()
        while True:
            if choice in ['y', 'ye', 'yes']:
                return True
            elif choice in ['n', 'no']:
                return False
            else:
                choice = input(
                    "Please respond with 'yes' or 'no' [y/N]: ").lower()
    except (EOFError, KeyboardInterrupt):
        return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号